]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: set number of osd ports in the tests 26703/head
authorAndrew Schoen <aschoen@redhat.com>
Mon, 4 Mar 2019 20:43:37 +0000 (14:43 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Mon, 4 Mar 2019 22:13:39 +0000 (16:13 -0600)
The number of ports the OSDs listen on depend on the version of ceph
being used, so we need to test for that number accordingly.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
(cherry picked from commit 1132cb3c25fef9f853488cc8aab1327aff6bcf96)

src/ceph-volume/ceph_volume/tests/functional/tests/conftest.py
src/ceph-volume/ceph_volume/tests/functional/tests/osd/test_osds.py

index b16ab7b9a9185470683d24d5934d934f6af5e05f..05c9aa521bc1baa96a086019ee2a7061ab93abf2 100644 (file)
@@ -4,8 +4,7 @@ import os
 
 @pytest.fixture()
 def node(host, request):
-    """
-    This fixture represents a single node in the ceph cluster. Using the
+    """ This fixture represents a single node in the ceph cluster. Using the
     host.ansible fixture provided by testinfra it can access all the ansible
     variables provided to it by the specific test scenario being ran.
 
@@ -14,18 +13,14 @@ def node(host, request):
     should run.
     """
     ansible_vars = host.ansible.get_variables()
-    # tox will pass in this environment variable. we need to do it this way
+    # tox/jenkins/user will pass in this environment variable. we need to do it this way
     # because testinfra does not collect and provide ansible config passed in
     # from using --extra-vars
-    ceph_stable_release = os.environ.get("CEPH_STABLE_RELEASE", "luminous")
+    ceph_dev_branch = os.environ.get("CEPH_DEV_BRANCH", "master")
     group_names = ansible_vars["group_names"]
-    ceph_release_num = {
-        'jewel': 10,
-        'kraken': 11,
-        'luminous': 12,
-        'mimic': 13,
-        'dev': 99
-    }
+    num_osd_ports = 4
+    if ceph_dev_branch in ['luminous', 'mimic']:
+        num_osd_ports = 2
 
     # capture the initial/default state
     test_is_applicable = False
@@ -76,12 +71,11 @@ def node(host, request):
         osd_ids=osd_ids,
         num_mons=num_mons,
         num_osds=num_osds,
+        num_osd_ports=num_osd_ports,
         cluster_name=cluster_name,
         conf_path=conf_path,
         cluster_address=cluster_address,
         osds=osds,
-        ceph_stable_release=ceph_stable_release,
-        ceph_release_num=ceph_release_num,
     )
     return data
 
index 0bc14aa87a6ce69adce4d703df861d0820ee7e82..6d12babdb3b2b13a9ad5fe7bdfede72ff0ca6054 100644 (file)
@@ -1,4 +1,3 @@
-import pytest
 import json
 
 
@@ -9,13 +8,13 @@ class TestOSDs(object):
 
     def test_osds_listen_on_public_network(self, node, host):
         # TODO: figure out way to paramaterize this test
-        nb_port = (node["num_osds"] * 4)
+        nb_port = (node["num_osds"] * node["num_osd_ports"])
         assert host.check_output(
             "netstat -lntp | grep ceph-osd | grep %s | wc -l" % (node["address"])) == str(nb_port)  # noqa E501
 
     def test_osds_listen_on_cluster_network(self, node, host):
         # TODO: figure out way to paramaterize this test
-        nb_port = (node["num_osds"] * 4)
+        nb_port = (node["num_osds"] * node["num_osd_ports"])
         assert host.check_output("netstat -lntp | grep ceph-osd | grep %s | wc -l" %  # noqa E501
                                  (node["cluster_address"])) == str(nb_port)