From fae04dc7ec17d0bf912c42abe35c26c11e3caa5a Mon Sep 17 00:00:00 2001 From: Adam King Date: Thu, 11 Aug 2022 14:26:11 -0400 Subject: [PATCH] mgr/cephadm: mock CephadmHttpServer run in unit tests While tests were still passing, since this server class was added the units tests are taking significantly longer to run and I'm seeing messages like Failed to run cephadm http server: Expected 4 octets in "" The run time given by "time tox -e py3" without this commit on my local machine was real 2m45.749s user 16m13.273s sys 0m11.041s and with this commit (and the server run function therefore mocked) real 0m36.164s user 0m26.932s sys 0m2.367s so it seems to run about 4x faster with the server run function mocked and the tests pass in both cases Issue introduced by: https://github.com/ceph/ceph/pull/46400/commits/a0fe3ffdaaddd661f115de78ddae89b07b98a9ae Signed-off-by: Adam King --- src/pybind/mgr/cephadm/tests/fixtures.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/cephadm/tests/fixtures.py b/src/pybind/mgr/cephadm/tests/fixtures.py index c2e7a6ed8d2..2ca027a37d5 100644 --- a/src/pybind/mgr/cephadm/tests/fixtures.py +++ b/src/pybind/mgr/cephadm/tests/fixtures.py @@ -99,8 +99,9 @@ def with_cephadm_module(module_options=None, store=None): mock.patch("cephadm.agent.CephadmAgentHelpers._apply_agent", return_value=False), \ mock.patch("cephadm.agent.CephadmAgentHelpers._agent_down", return_value=False), \ mock.patch('cephadm.offline_watcher.OfflineHostWatcher.run'), \ - mock.patch('cephadm.tuned_profiles.TunedProfileUtils._remove_stray_tuned_profiles'),\ - mock.patch('cephadm.offline_watcher.OfflineHostWatcher.run'): + mock.patch('cephadm.tuned_profiles.TunedProfileUtils._remove_stray_tuned_profiles'), \ + mock.patch('cephadm.offline_watcher.OfflineHostWatcher.run'), \ + mock.patch('cephadm.http_server.CephadmHttpServer.run'): m = CephadmOrchestrator.__new__(CephadmOrchestrator) if module_options is not None: -- 2.39.5