2016-10-28 03:39:12 +08:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
2016-12-03 22:07:09 +08:00
|
|
|
@pytest.fixture()
|
2016-12-04 10:01:30 +08:00
|
|
|
def CephNode(Ansible, Interface, request):
|
2016-12-03 22:07:09 +08:00
|
|
|
vars = Ansible.get_variables()
|
|
|
|
node_type = vars["group_names"][0]
|
|
|
|
if not request.node.get_marker(node_type):
|
|
|
|
pytest.skip("Not a valid test for node type")
|
|
|
|
|
2016-12-04 10:01:30 +08:00
|
|
|
# I can assume eth1 because I know all the vagrant
|
|
|
|
# boxes we test with use that interface
|
|
|
|
address = Interface("eth1").addresses[0]
|
|
|
|
data = dict(
|
|
|
|
address=address,
|
|
|
|
vars=vars,
|
|
|
|
)
|
|
|
|
return data
|
|
|
|
|
2016-12-03 22:07:09 +08:00
|
|
|
|
|
|
|
def pytest_collection_modifyitems(session, config, items):
|
|
|
|
for item in items:
|
|
|
|
test_path = item.location[0]
|
|
|
|
if "mon" in test_path:
|
|
|
|
item.add_marker(pytest.mark.mons)
|
|
|
|
elif "osd" in test_path:
|
|
|
|
item.add_marker(pytest.mark.osds)
|
|
|
|
elif "mds" in test_path:
|
|
|
|
item.add_marker(pytest.mark.mdss)
|
|
|
|
elif "rgw" in test_path:
|
|
|
|
item.add_marker(pytest.mark.rgws)
|
|
|
|
else:
|
|
|
|
item.add_marker(pytest.mark.all)
|