From 2464b69612680c2fbf2cc0dc3c95d3684984bdec Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 6 Dec 2016 10:55:20 -0600 Subject: [PATCH] tests: include the number of mons as a attribute on node Signed-off-by: Andrew Schoen --- tests/conftest.py | 4 ++++ tests/functional/tests/test_install.py | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index f980dcfd1..a3d8bea75 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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 diff --git a/tests/functional/tests/test_install.py b/tests/functional/tests/test_install.py index d12f6123b..c019276b6 100644 --- a/tests/functional/tests/test_install.py +++ b/tests/functional/tests/test_install.py @@ -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) -- 2.39.5