From 955575c389798f23bd87acdc721610bad068cf76 Mon Sep 17 00:00:00 2001 From: Tim Serong Date: Mon, 23 Aug 2021 18:57:47 +1000 Subject: [PATCH] gravel/tests: handle new KV correctly in conftest.py We need to make sure python3-rados is mocked out, and the connection thread doesn't keep running when testing. Signed-off-by: Tim Serong --- src/gravel/tests/conftest.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gravel/tests/conftest.py b/src/gravel/tests/conftest.py index c7139d81c..6acccb224 100644 --- a/src/gravel/tests/conftest.py +++ b/src/gravel/tests/conftest.py @@ -171,6 +171,8 @@ async def cancel_watch(self, watch_id: int) -> None: async def aquarium_startup( get_data_contents: Callable[[str, str], str], mocker: MockerFixture ): + mock_ceph_modules(mocker) + async def startup(aquarium_app: FastAPI, aquarium_api: FastAPI): from fastapi.logger import logger as fastapi_logger @@ -280,6 +282,11 @@ class FakeStorage(Storage): # type: ignore total = 2000 # type: ignore gstate: GlobalState = GlobalState() + # gstate's KV store will start a thread to try to connect to the + # cluster. This can't work in a test environment, so tell it to + # close (otherwise the thread will spin forever and the tests will + # never complete) + await gstate._kvstore.close() gstate._kvstore = FakeKV() # pyright: reportPrivateUsage=false # init node mgr