tests: test ceph.conf using testinfra modules

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
pull/1150/head
Andrew Schoen 2016-12-05 12:06:46 -06:00
parent 4810b38ece
commit 20f6831f8b
1 changed files with 23 additions and 0 deletions

View File

@ -15,3 +15,26 @@ class TestInstall(object):
def test_ceph_command_exists(self, Command):
assert Command.exists("ceph")
class TestCephConf(object):
def test_ceph_config_has_inital_members_line(self, CephNode, File):
assert File("/etc/ceph/ceph.conf").contains("^mon initial members = .*$")
def test_initial_members_line_has_correct_value(self, CephNode, File):
mons = ",".join("ceph-%s" % host
for host in CephNode["vars"]["groups"]["mons"])
line = "mon initial members = {}".format(mons)
assert File("/etc/ceph/ceph.conf").contains(line)
def test_ceph_config_has_mon_host_line(self, CephNode, File):
assert File("/etc/ceph/ceph.conf").contains("^mon host = .*$")
def test_mon_host_line_has_correct_value(self, CephNode, File):
num_mons = len(CephNode["vars"]["groups"]["mons"])
mon_ips = []
for x in range(0, num_mons):
mon_ips.append("{}.1{}".format(CephNode["subnet"], x))
line = "mon host = {}".format(",".join(mon_ips))
assert File("/etc/ceph/ceph.conf").contains(line)