]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
tests: test ceph.conf using testinfra modules
authorAndrew Schoen <aschoen@redhat.com>
Mon, 5 Dec 2016 18:06:46 +0000 (12:06 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Tue, 6 Dec 2016 20:56:19 +0000 (14:56 -0600)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
tests/functional/tests/test_install.py

index 47b1938c3a9fff572995f5e16f08c3b4f995fad9..23f6e362c2fd4d5de2197427f569ebd0ac12a566 100644 (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)