]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
tests: include the number of mons as a attribute on node
authorAndrew Schoen <aschoen@redhat.com>
Tue, 6 Dec 2016 16:55:20 +0000 (10:55 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Tue, 6 Dec 2016 20:57:20 +0000 (14:57 -0600)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
tests/conftest.py
tests/functional/tests/test_install.py

index f980dcfd159c287a5af317fae62b98d337485d5a..a3d8bea75fb2332ebb3cfddc4cb5b62e2802e425 100644 (file)
@@ -28,11 +28,15 @@ def node(Ansible, Interface, Command, request):
     # boxes we test with use that interface
     address = Interface("eth1").addresses[0]
     subnet = ".".join(ansible_vars["public_network"].split(".")[0:-1])
+    num_mons = len(ansible_vars["groups"]["mons"])
+    cluster_name = ansible_vars.get("cluster", "ceph")
+    conf_path = "/etc/ceph/{}.conf".format(cluster_name)
     data = dict(
         address=address,
         subnet=subnet,
         vars=ansible_vars,
         osd_ids=osd_ids,
+        num_mons=num_mons,
     )
     return data
 
index d12f6123b238e4c988c8717a24cb43a30d3d279e..c019276b6e54fa0b0217242b2fd3bf5d66a3d243 100644 (file)
@@ -32,9 +32,8 @@ class TestCephConf(object):
         assert File("/etc/ceph/ceph.conf").contains("^mon host = .*$")
 
     def test_mon_host_line_has_correct_value(self, node, File):
-        num_mons = len(node["vars"]["groups"]["mons"])
         mon_ips = []
-        for x in range(0, num_mons):
+        for x in range(0, node["num_mons"]):
             mon_ips.append("{}.1{}".format(node["subnet"], x))
         line = "mon host = {}".format(",".join(mon_ips))
         assert File("/etc/ceph/ceph.conf").contains(line)