From 20f6831f8b10bf38f02d832bf1d1b648de1e905c Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Mon, 5 Dec 2016 12:06:46 -0600 Subject: [PATCH] tests: test ceph.conf using testinfra modules Signed-off-by: Andrew Schoen --- tests/functional/tests/test_install.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/functional/tests/test_install.py b/tests/functional/tests/test_install.py index 47b1938c3..23f6e362c 100644 --- a/tests/functional/tests/test_install.py +++ b/tests/functional/tests/test_install.py @@ -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) -- 2.39.5