File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
tests/integration/test_mcp Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,9 @@ async def shutdown(self) -> None:
8787 self ._vectorizer = None
8888 finally :
8989 if self ._index is not None :
90- await self ._index .disconnect ()
90+ index = self ._index
91+ self ._index = None
92+ await index .disconnect ()
9193
9294 async def get_index (self ) -> AsyncSearchIndex :
9395 """Return the initialized async index or fail if startup has not run."""
Original file line number Diff line number Diff line change @@ -199,6 +199,26 @@ async def test_server_shutdown_disconnects_owned_client(
199199 assert index .client is None
200200
201201
202+ @pytest .mark .asyncio
203+ async def test_server_get_index_fails_after_shutdown (
204+ monkeypatch , mcp_config_path , worker_id
205+ ):
206+ monkeypatch .setattr (
207+ "redisvl.mcp.server.resolve_vectorizer_class" ,
208+ lambda class_name : FakeVectorizer ,
209+ )
210+ settings = MCPSettings (
211+ config = mcp_config_path (index_name = f"mcp-get-index-after-shutdown-{ worker_id } " )
212+ )
213+ server = RedisVLMCPServer (settings )
214+
215+ await server .startup ()
216+ await server .shutdown ()
217+
218+ with pytest .raises (RuntimeError , match = "has not been started" ):
219+ await server .get_index ()
220+
221+
202222@pytest .mark .asyncio
203223async def test_server_shutdown_disconnects_index_when_vectorizer_close_fails (
204224 monkeypatch , mcp_config_path , worker_id
You can’t perform that action at this time.
0 commit comments