mirror of https://github.com/ceph/ceph-ansible.git
tests: use cluster_name in tests when needed
Signed-off-by: Andrew Schoen <aschoen@redhat.com>pull/1150/head
parent
4effce1c31
commit
13333d9724
|
@ -8,22 +8,28 @@ class TestMons(object):
|
||||||
assert Socket("tcp://%s:6789" % node["address"]).is_listening
|
assert Socket("tcp://%s:6789" % node["address"]).is_listening
|
||||||
|
|
||||||
def test_mon_service_is_running(self, node, Service):
|
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
|
assert Service(service_name).is_running
|
||||||
|
|
||||||
def test_mon_service_is_enabled(self, node, Service):
|
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
|
assert Service(service_name).is_enabled
|
||||||
|
|
||||||
def test_can_get_cluster_health(self, node, Command):
|
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")
|
assert output.strip().startswith("cluster")
|
||||||
|
|
||||||
|
|
||||||
class TestOSDs(object):
|
class TestOSDs(object):
|
||||||
|
|
||||||
def test_all_osds_are_up_and_in(self, node, Command):
|
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"])
|
num_osds = len(node["vars"]["devices"])
|
||||||
phrase = "{num_osds} osds: {num_osds} up, {num_osds} in".format(num_osds=num_osds)
|
phrase = "{num_osds} osds: {num_osds} up, {num_osds} in".format(num_osds=num_osds)
|
||||||
assert phrase in output
|
assert phrase in output
|
||||||
|
|
|
@ -20,4 +20,8 @@ class TestOSDs(object):
|
||||||
def test_osd_are_mounted(self, node, MountPoint):
|
def test_osd_are_mounted(self, node, MountPoint):
|
||||||
# TODO: figure out way to paramaterize node['osd_ids'] for this test
|
# TODO: figure out way to paramaterize node['osd_ids'] for this test
|
||||||
for osd_id in node["osd_ids"]:
|
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
|
||||||
|
|
Loading…
Reference in New Issue