mirror of https://github.com/ceph/ceph-ansible.git
tests: use node["conf_path"] instead of hardcoding the path in tests
This also accounts for the cluster having a custom cluster name Signed-off-by: Andrew Schoen <aschoen@redhat.com>pull/1150/head
parent
4e3eb7b627
commit
4effce1c31
|
@ -7,11 +7,11 @@ class TestInstall(object):
|
||||||
def test_ceph_dir_is_a_directory(self, File):
|
def test_ceph_dir_is_a_directory(self, File):
|
||||||
assert File('/etc/ceph').is_directory
|
assert File('/etc/ceph').is_directory
|
||||||
|
|
||||||
def test_ceph_conf_exists(self, File):
|
def test_ceph_conf_exists(self, File, node):
|
||||||
assert File('/etc/ceph/ceph.conf').exists
|
assert File(node["conf_path"]).exists
|
||||||
|
|
||||||
def test_ceph_conf_is_a_file(self, File):
|
def test_ceph_conf_is_a_file(self, File, node):
|
||||||
assert File('/etc/ceph/ceph.conf').is_file
|
assert File(node["conf_path"]).is_file
|
||||||
|
|
||||||
def test_ceph_command_exists(self, Command):
|
def test_ceph_command_exists(self, Command):
|
||||||
assert Command.exists("ceph")
|
assert Command.exists("ceph")
|
||||||
|
@ -20,20 +20,20 @@ class TestInstall(object):
|
||||||
class TestCephConf(object):
|
class TestCephConf(object):
|
||||||
|
|
||||||
def test_ceph_config_has_inital_members_line(self, node, File):
|
def test_ceph_config_has_inital_members_line(self, node, File):
|
||||||
assert File("/etc/ceph/ceph.conf").contains("^mon initial members = .*$")
|
assert File(node["conf_path"]).contains("^mon initial members = .*$")
|
||||||
|
|
||||||
def test_initial_members_line_has_correct_value(self, node, File):
|
def test_initial_members_line_has_correct_value(self, node, File):
|
||||||
mons = ",".join("ceph-%s" % host
|
mons = ",".join("ceph-%s" % host
|
||||||
for host in node["vars"]["groups"]["mons"])
|
for host in node["vars"]["groups"]["mons"])
|
||||||
line = "mon initial members = {}".format(mons)
|
line = "mon initial members = {}".format(mons)
|
||||||
assert File("/etc/ceph/ceph.conf").contains(line)
|
assert File(node["conf_path"]).contains(line)
|
||||||
|
|
||||||
def test_ceph_config_has_mon_host_line(self, node, File):
|
def test_ceph_config_has_mon_host_line(self, node, File):
|
||||||
assert File("/etc/ceph/ceph.conf").contains("^mon host = .*$")
|
assert File(node["conf_path"]).contains("^mon host = .*$")
|
||||||
|
|
||||||
def test_mon_host_line_has_correct_value(self, node, File):
|
def test_mon_host_line_has_correct_value(self, node, File):
|
||||||
mon_ips = []
|
mon_ips = []
|
||||||
for x in range(0, node["num_mons"]):
|
for x in range(0, node["num_mons"]):
|
||||||
mon_ips.append("{}.1{}".format(node["subnet"], x))
|
mon_ips.append("{}.1{}".format(node["subnet"], x))
|
||||||
line = "mon host = {}".format(",".join(mon_ips))
|
line = "mon host = {}".format(",".join(mon_ips))
|
||||||
assert File("/etc/ceph/ceph.conf").contains(line)
|
assert File(node["conf_path"]).contains(line)
|
||||||
|
|
Loading…
Reference in New Issue