From 13333d9724bfe2dfa27feb6b5685d11bfee77089 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 6 Dec 2016 14:07:40 -0600 Subject: [PATCH] tests: use cluster_name in tests when needed Signed-off-by: Andrew Schoen --- tests/functional/tests/mon/test_mons.py | 14 ++++++++++---- tests/functional/tests/osd/test_osds.py | 6 +++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/functional/tests/mon/test_mons.py b/tests/functional/tests/mon/test_mons.py index 1ba4d1d68..5f98d372a 100644 --- a/tests/functional/tests/mon/test_mons.py +++ b/tests/functional/tests/mon/test_mons.py @@ -8,22 +8,28 @@ class TestMons(object): assert Socket("tcp://%s:6789" % node["address"]).is_listening def test_mon_service_is_running(self, node, Service): - service_name = "ceph-mon@ceph-%s" % node["vars"]["inventory_hostname"] + service_name = "ceph-mon@ceph-{hostname}".format( + hostname=node["vars"]["inventory_hostname"] + ) assert Service(service_name).is_running def test_mon_service_is_enabled(self, node, Service): - service_name = "ceph-mon@ceph-%s" % node["vars"]["inventory_hostname"] + service_name = "ceph-mon@ceph-{hostname}".format( + hostname=node["vars"]["inventory_hostname"] + ) assert Service(service_name).is_enabled def test_can_get_cluster_health(self, node, Command): - output = Command.check_output("sudo ceph -s") + cmd = "sudo ceph --cluster={} --connect-timeout 5 -s".format(node["cluster_name"]) + output = Command.check_output(cmd) assert output.strip().startswith("cluster") class TestOSDs(object): def test_all_osds_are_up_and_in(self, node, Command): - output = Command.check_output("sudo ceph -s") + cmd = "sudo ceph --cluster={} --connect-timeout 5 -s".format(node["cluster_name"]) + output = Command.check_output(cmd) num_osds = len(node["vars"]["devices"]) phrase = "{num_osds} osds: {num_osds} up, {num_osds} in".format(num_osds=num_osds) assert phrase in output diff --git a/tests/functional/tests/osd/test_osds.py b/tests/functional/tests/osd/test_osds.py index e3052e212..efb15ff2e 100644 --- a/tests/functional/tests/osd/test_osds.py +++ b/tests/functional/tests/osd/test_osds.py @@ -20,4 +20,8 @@ class TestOSDs(object): def test_osd_are_mounted(self, node, MountPoint): # TODO: figure out way to paramaterize node['osd_ids'] for this test for osd_id in node["osd_ids"]: - assert MountPoint("/var/lib/ceph/osd/ceph-%s" % osd_id).exists + osd_path = "/var/lib/ceph/osd/{cluster}-{osd_id}".format( + cluster=node["cluster_name"], + osd_id=osd_id, + ) + assert MountPoint(osd_path).exists