From: Tiago Melo Date: Mon, 14 Sep 2020 11:24:48 +0000 (+0000) Subject: mgr/dashboard: Fix iSCSI backend unit-test X-Git-Tag: v16.1.0~1028^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=833c86f035f45635ef644ef675abb90960643c8d;p=ceph-ci.git mgr/dashboard: Fix iSCSI backend unit-test This allows us to run iSCSI tests individually. Fixes: https://tracker.ceph.com/issues/47391 Signed-off-by: Tiago Melo --- diff --git a/src/pybind/mgr/dashboard/tests/test_exceptions.py b/src/pybind/mgr/dashboard/tests/test_exceptions.py index 2bb25da1bf3..a7ab3a643a8 100644 --- a/src/pybind/mgr/dashboard/tests/test_exceptions.py +++ b/src/pybind/mgr/dashboard/tests/test_exceptions.py @@ -88,6 +88,10 @@ class RESTControllerTest(ControllerTestCase): TaskManager.init() cls.setup_controllers([FooResource]) + @classmethod + def tearDownClass(cls): + NotificationQueue.stop() + def test_no_exception(self): self._get('/foo/no_exception/a/b') self.assertStatus(200) diff --git a/src/pybind/mgr/dashboard/tests/test_iscsi.py b/src/pybind/mgr/dashboard/tests/test_iscsi.py index 962ffeb6846..728158a82ba 100644 --- a/src/pybind/mgr/dashboard/tests/test_iscsi.py +++ b/src/pybind/mgr/dashboard/tests/test_iscsi.py @@ -16,6 +16,7 @@ from ..controllers.iscsi import Iscsi, IscsiTarget from ..services.iscsi_client import IscsiClient from ..services.orchestrator import OrchClient from ..rest_client import RequestException +from ..tools import NotificationQueue, TaskManager class IscsiTestCli(unittest.TestCase, CLICommandTestMixin): @@ -66,6 +67,8 @@ class IscsiTestController(ControllerTestCase, KVStoreMockMixin): @classmethod def setup_server(cls): + NotificationQueue.start_queue() + TaskManager.init() OrchClient.instance().available = lambda: False mgr.rados.side_effect = None # pylint: disable=protected-access @@ -73,6 +76,10 @@ class IscsiTestController(ControllerTestCase, KVStoreMockMixin): IscsiTarget._cp_config['tools.authenticate.on'] = False cls.setup_controllers([Iscsi, IscsiTarget]) + @classmethod + def tearDownClass(cls): + NotificationQueue.stop() + def setUp(self): self.mock_kv_store() self.CONFIG_KEY_DICT['_iscsi_config'] = '''