diff options
Diffstat (limited to 'qa/tasks/mgr')
-rw-r--r-- | qa/tasks/mgr/dashboard/helper.py | 4 | ||||
-rw-r--r-- | qa/tasks/mgr/dashboard/test_mgr_module.py | 4 | ||||
-rw-r--r-- | qa/tasks/mgr/dashboard/test_rbd.py | 12 | ||||
-rw-r--r-- | qa/tasks/mgr/dashboard/test_rgw.py | 4 | ||||
-rw-r--r-- | qa/tasks/mgr/mgr_test_case.py | 19 |
5 files changed, 34 insertions, 9 deletions
diff --git a/qa/tasks/mgr/dashboard/helper.py b/qa/tasks/mgr/dashboard/helper.py index e6a7c35a23d..55355048a36 100644 --- a/qa/tasks/mgr/dashboard/helper.py +++ b/qa/tasks/mgr/dashboard/helper.py @@ -220,13 +220,11 @@ class DashboardTestCase(MgrTestCase): # To avoid any issues with e.g. unlink bugs, we destroy and recreate # the filesystem rather than just doing a rm -rf of files - cls.mds_cluster.mds_stop() - cls.mds_cluster.mds_fail() cls.mds_cluster.delete_all_filesystems() + cls.mds_cluster.mds_restart() # to reset any run-time configs, etc. cls.fs = None # is now invalid! cls.fs = cls.mds_cluster.newfs(create=True) - cls.fs.mds_restart() # In case some test messed with auth caps, reset them # pylint: disable=not-an-iterable diff --git a/qa/tasks/mgr/dashboard/test_mgr_module.py b/qa/tasks/mgr/dashboard/test_mgr_module.py index d6a368905b6..1dbdef23d34 100644 --- a/qa/tasks/mgr/dashboard/test_mgr_module.py +++ b/qa/tasks/mgr/dashboard/test_mgr_module.py @@ -4,6 +4,7 @@ from __future__ import absolute_import import logging import requests +from urllib3.exceptions import MaxRetryError from .helper import (DashboardTestCase, JLeaf, JList, JObj, module_options_object_schema, module_options_schema, @@ -24,10 +25,11 @@ class MgrModuleTestCase(DashboardTestCase): def _check_connection(): try: # Try reaching an API endpoint successfully. + logger.info('Trying to reach the REST API endpoint') self._get('/api/mgr/module') if self._resp.status_code == 200: return True - except requests.ConnectionError: + except (MaxRetryError, requests.ConnectionError): pass return False diff --git a/qa/tasks/mgr/dashboard/test_rbd.py b/qa/tasks/mgr/dashboard/test_rbd.py index a872645e33e..83b3bf520c2 100644 --- a/qa/tasks/mgr/dashboard/test_rbd.py +++ b/qa/tasks/mgr/dashboard/test_rbd.py @@ -869,7 +869,19 @@ class RbdTest(DashboardTestCase): self.assertEqual(clone_format_version, 2) self.assertStatus(200) + # if empty list is sent, then the config will remain as it is value = [] + res = [{'section': "global", 'value': "2"}] + self._post('/api/cluster_conf', { + 'name': config_name, + 'value': value + }) + self.wait_until_equal( + lambda: _get_config_by_name(config_name), + res, + timeout=60) + + value = [{'section': "global", 'value': ""}] self._post('/api/cluster_conf', { 'name': config_name, 'value': value diff --git a/qa/tasks/mgr/dashboard/test_rgw.py b/qa/tasks/mgr/dashboard/test_rgw.py index 5c7b0329675..a9071bc2a3a 100644 --- a/qa/tasks/mgr/dashboard/test_rgw.py +++ b/qa/tasks/mgr/dashboard/test_rgw.py @@ -785,7 +785,7 @@ class RgwUserSubuserTest(RgwTestCase): 'access': 'readwrite', 'key_type': 'swift' }) - self.assertStatus(200) + self.assertStatus(201) data = self.jsonBody() subuser = self.find_object_in_list('id', 'teuth-test-user:tux', data) self.assertIsInstance(subuser, object) @@ -808,7 +808,7 @@ class RgwUserSubuserTest(RgwTestCase): 'access_key': 'yyy', 'secret_key': 'xxx' }) - self.assertStatus(200) + self.assertStatus(201) data = self.jsonBody() subuser = self.find_object_in_list('id', 'teuth-test-user:hugo', data) self.assertIsInstance(subuser, object) diff --git a/qa/tasks/mgr/mgr_test_case.py b/qa/tasks/mgr/mgr_test_case.py index 9032e0e2658..4a5506391f2 100644 --- a/qa/tasks/mgr/mgr_test_case.py +++ b/qa/tasks/mgr/mgr_test_case.py @@ -1,5 +1,6 @@ import json import logging +import socket from unittest import SkipTest @@ -229,15 +230,22 @@ class MgrTestCase(CephTestCase): """ # Start handing out ports well above Ceph's range. assign_port = min_port + ip_addr = cls.mgr_cluster.get_mgr_map()['active_addr'].split(':')[0] for mgr_id in cls.mgr_cluster.mgr_ids: cls.mgr_cluster.mgr_stop(mgr_id) cls.mgr_cluster.mgr_fail(mgr_id) + for mgr_id in cls.mgr_cluster.mgr_ids: - log.debug("Using port {0} for {1} on mgr.{2}".format( - assign_port, module_name, mgr_id - )) + # Find a port that isn't in use + while True: + if not cls.is_port_in_use(ip_addr, assign_port): + break + log.debug(f"Port {assign_port} in use, trying next") + assign_port += 1 + + log.debug(f"Using port {assign_port} for {module_name} on mgr.{mgr_id}") cls.mgr_cluster.set_module_localized_conf(module_name, mgr_id, config_name, str(assign_port), @@ -255,3 +263,8 @@ class MgrTestCase(CephTestCase): mgr_map['active_name'], mgr_map['active_gid'])) return done cls.wait_until_true(is_available, timeout=30) + + @classmethod + def is_port_in_use(cls, ip_addr: str, port: int) -> bool: + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: + return s.connect_ex((ip_addr, port)) == 0 |