import pytest
-
+import re
class TestMons(object):
def test_ceph_config_has_inital_members_line(self, node, File):
assert File(node["conf_path"]).contains("^mon initial members = .*$")
- def test_initial_members_line_has_correct_value(self, node, File):
- mons = ",".join("%s" % host
- for host in node["vars"]["groups"]["mons"])
- line = "mon initial members = {}".format(mons)
- assert File(node["conf_path"]).contains(line)
+ def test_initial_members_line_has_correct_value(self, node, host, File):
+ mon_initial_members_line = host.check_output("grep 'mon initial members = ' /etc/ceph/{cluster}.conf".format(cluster=node['cluster_name']))
+ result = True
+ for host in node["vars"]["groups"]["mons"]:
+ pattern = re.compile(host)
+ if pattern.search(mon_initial_members_line) == None:
+ result = False
+ assert result
class TestOSDs(object):
import pytest
-
+import re
class TestInstall(object):
assert File(node["conf_path"]).contains("^mon host = .*$")
def test_mon_host_line_has_correct_value(self, node, host):
- mon_ips = []
+ mon_host_line = host.check_output("grep 'mon host = ' /etc/ceph/{cluster}.conf".format(cluster=node['cluster_name']))
+ result=True
for x in range(0, node["num_mons"]):
- mon_ips.append("{}.1{}".format(node["subnet"], x))
- line = "mon host = {}".format(",".join(mon_ips))
- assert host.file(node["conf_path"]).contains(line)
+ pattern=re.compile(("{}.1{}".format(node["subnet"], x)))
+ if pattern.search(mon_host_line) == None:
+ result=False
+ assert result