]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
tests: fix rgw testinfra failure
authorGuillaume Abrioux <gabrioux@redhat.com>
Fri, 25 Jan 2019 10:05:55 +0000 (11:05 +0100)
committermergify[bot] <mergify[bot]@users.noreply.github.com>
Fri, 25 Jan 2019 11:11:16 +0000 (11:11 +0000)
fix the wrong path used in various rgw testinfra tests.
set `1` as default value for `radosgw_num_instances`: if
`ansible_vars.get(radosgw_num_instances)` returns `None`, we can assume
there's only 1 instance since it's the default value in ceph-defaults.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
tests/conftest.py
tests/functional/tests/rgw/test_rgw.py

index a7ebfd9b44b33b613205d51d22c63c4507ff2144..103965c3e8190cc2e3ce112386cbc69cf27cd006 100644 (file)
@@ -24,6 +24,7 @@ def node(host, request):
     fsid = ansible_vars.get("fsid")
     osd_auto_discovery = ansible_vars.get("osd_auto_discovery")
     osd_scenario = ansible_vars.get("osd_scenario")
+    radosgw_num_instances = ansible_vars.get("radosgw_num_instances", 1)
     lvm_scenario = osd_scenario in ['lvm', 'lvm-batch']
     ceph_release_num = {
         'jewel': 10,
@@ -117,6 +118,7 @@ def node(host, request):
         ceph_stable_release=ceph_stable_release,
         ceph_release_num=ceph_release_num,
         rolling_update=rolling_update,
+        radosgw_num_instances=radosgw_num_instances,
     )
     return data
 
index d1e9b7d06e6d33438b36737515910e500265c07b..eed21c46e58b33fead6a52ef6c795b0032bba52e 100644 (file)
@@ -12,7 +12,7 @@ class TestRGWs(object):
         assert result
 
     def test_rgw_service_is_running(self, node, host):
-        for i in range(int(node["vars"]["radosgw_num_instances"])):
+        for i in range(int(node["radosgw_num_instances"])):
             service_name = "ceph-radosgw@rgw.{hostname}.rgw{seq}".format(
                 hostname=node["vars"]["inventory_hostname"],
                 seq=i
@@ -20,7 +20,7 @@ class TestRGWs(object):
             assert host.service(service_name).is_running
 
     def test_rgw_service_is_enabled(self, node, host):
-        for i in range(int(node["vars"]["radosgw_num_instances"])):
+        for i in range(int(node["radosgw_num_instances"])):
             service_name = "ceph-radosgw@rgw.{hostname}.rgw{seq}".format(
                 hostname=node["vars"]["inventory_hostname"],
                 seq=i
@@ -46,7 +46,7 @@ class TestRGWs(object):
         output = host.check_output(cmd)
         daemons = [i for i in json.loads(
             output)["servicemap"]["services"]["rgw"]["daemons"]]
-        for i in range(int(node["vars"]["radosgw_num_instances"])):
+        for i in range(int(node["radosgw_num_instances"])):
             instance_name = "{hostname}.rgw{seq}".format(
                 hostname=hostname,
                 seq=i
@@ -57,7 +57,7 @@ class TestRGWs(object):
     def test_rgw_http_endpoint(self, node, host):
         # rgw frontends ip_addr is configured on eth1
         ip_addr = host.interface("eth1").addresses[0]
-        for i in range(int(node["vars"]["radosgw_num_instances"])):
+        for i in range(int(node["radosgw_num_instances"])):
             assert host.socket(
                 "tcp://{ip_addr}:{port}".format(ip_addr=ip_addr,
                                                 port=(8080+i))