From 6baf2192cdbf48b7bbeb086d9f49e0b7a76a58f5 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Wed, 7 Dec 2016 19:24:40 -0600 Subject: [PATCH] tests: adds an osds parameter to the node fixture The osds are named differently for systemd in containerized deployments so this new parameter is used to make that change transparent in the tests. Signed-off-by: Andrew Schoen --- tests/conftest.py | 5 +++++ tests/functional/tests/osd/test_osds.py | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 815727c59..5fd2c155d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -25,6 +25,7 @@ def node(Ansible, Interface, Command, request): pytest.skip("Scenario is not using journal collocation") osd_ids = [] + osds = [] cluster_address = "" if node_type == "osds": result = Command.check_output('sudo ls /var/lib/ceph/osd/ | grep -oP "\d+$"') @@ -33,6 +34,9 @@ def node(Ansible, Interface, Command, request): # boxes we test with use that interface. OSDs are the only # nodes that have this interface. cluster_address = Interface("eth2").addresses[0] + osds = osd_ids + if docker: + osds = [device.split("/")[-1] for device in ansible_vars["devices"]] # I can assume eth1 because I know all the vagrant # boxes we test with use that interface @@ -57,6 +61,7 @@ def node(Ansible, Interface, Command, request): conf_path=conf_path, cluster_address=cluster_address, docker=docker, + osds=osds, ) return data diff --git a/tests/functional/tests/osd/test_osds.py b/tests/functional/tests/osd/test_osds.py index b754a0d4b..4ae18165b 100644 --- a/tests/functional/tests/osd/test_osds.py +++ b/tests/functional/tests/osd/test_osds.py @@ -26,14 +26,14 @@ class TestOSDs(object): )).is_listening def test_osd_services_are_running(self, node, Service): - # TODO: figure out way to paramaterize node['osd_ids'] for this test - for osd_id in node["osd_ids"]: - assert Service("ceph-osd@%s" % osd_id).is_running + # TODO: figure out way to paramaterize node['osds'] for this test + for osd in node["osds"]: + assert Service("ceph-osd@%s" % osd).is_running def test_osd_services_are_enabled(self, node, Service): - # TODO: figure out way to paramaterize node['osd_ids'] for this test - for osd_id in node["osd_ids"]: - assert Service("ceph-osd@%s" % osd_id).is_enabled + # TODO: figure out way to paramaterize node['osds'] for this test + for osd in node["osds"]: + assert Service("ceph-osd@%s" % osd).is_enabled @pytest.mark.no_docker def test_osd_are_mounted(self, node, MountPoint): -- 2.39.5