tests: use cluster_name in tests when needed

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
pull/1150/head
Andrew Schoen 2016-12-06 14:07:40 -06:00
parent 4effce1c31
commit 13333d9724
2 changed files with 15 additions and 5 deletions

View File

@ -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

View File

@ -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