]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: remove test_stale_connections
authorMelissa <li.melissa.kun@gmail.com>
Wed, 21 Jul 2021 03:33:37 +0000 (23:33 -0400)
committerMelissa Li <li.melissa.kun@gmail.com>
Fri, 20 Aug 2021 18:27:46 +0000 (14:27 -0400)
remove test_stale_connections because it applies to remoto

Fixes: https://tracker.ceph.com/issues/44676
Signed-off-by: Melissa Li <li.melissa.kun@gmail.com>
src/pybind/mgr/cephadm/tests/test_cephadm.py

index 125c4132b90c966494b07c1b309cc15aa403d2a6..f6747fd54faa9b0ee9fbd3402448c928346dddcc 100644 (file)
@@ -1131,47 +1131,6 @@ spec:
                             assert len(cephadm_module.cache.get_daemons_by_type('mgr')) == 3
                             assert len(cephadm_module.cache.get_daemons_by_type('crash')) == 1
 
-    def test_stale_connections(self, cephadm_module):
-        class Connection(object):
-            """
-            A mocked connection class that only allows the use of the connection
-            once. If you attempt to use it again via a _check, it'll explode (go
-            boom!).
-
-            The old code triggers the boom. The new code checks the has_connection
-            and will recreate the connection.
-            """
-            fuse = False
-
-            @ staticmethod
-            def has_connection():
-                return False
-
-            def import_module(self, *args, **kargs):
-                return mock.Mock()
-
-            @ staticmethod
-            def exit():
-                pass
-
-        def _check(conn, *args, **kargs):
-            if conn.fuse:
-                raise Exception("boom: connection is dead")
-            else:
-                conn.fuse = True
-            return '{}', [], 0
-        with mock.patch("remoto.Connection", side_effect=[Connection(), Connection(), Connection()]):
-            with mock.patch("remoto.process.check", _check):
-                with with_host(cephadm_module, 'test', refresh_hosts=False):
-                    code, out, err = cephadm_module.check_host('test')
-                    # First should succeed.
-                    assert err == ''
-
-                    # On second it should attempt to reuse the connection, where the
-                    # connection is "down" so will recreate the connection. The old
-                    # code will blow up here triggering the BOOM!
-                    code, out, err = cephadm_module.check_host('test')
-                    assert err == ''
 
     @mock.patch("cephadm.module.CephadmOrchestrator._get_connection")
     @mock.patch("remoto.process.check")