]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
mgr/cephadm: mock CephadmHttpServer run in unit tests
authorAdam King <adking@redhat.com>
Thu, 11 Aug 2022 18:26:11 +0000 (14:26 -0400)
committerAdam King <adking@redhat.com>
Thu, 11 Aug 2022 18:30:04 +0000 (14:30 -0400)
commitfae04dc7ec17d0bf912c42abe35c26c11e3caa5a
treeeb5bb625d3550696d0bf2e44619598325f4fc220
parent5ab5ff46d6d799c46d8a1c01cc08068a22e4c9b5
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 "<MagicMock name='mock.get().__getitem__()' id='139931011514704'>"

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 <adking@redhat.com>
src/pybind/mgr/cephadm/tests/fixtures.py