Skip to content

Commit df4b30f

Browse files
committed
fix: enhance error handling for Qdrant initialization failures
1 parent 467f4db commit df4b30f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/services/code-index/vector-store/__tests__/qdrant-client.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ describe("QdrantVectorStore", () => {
227227
mockQdrantClientInstance.createCollection.mockRejectedValue(createError)
228228
vitest.spyOn(console, "error").mockImplementation(() => {}) // Suppress console.error
229229

230-
await expect(vectorStore.initialize()).rejects.toThrow(createError)
230+
// The actual error message includes the URL and error details
231+
await expect(vectorStore.initialize()).rejects.toThrow(
232+
/Failed to connect to Qdrant vector database|vectorStore\.qdrantConnectionFailed/,
233+
)
231234

232235
expect(mockQdrantClientInstance.getCollection).toHaveBeenCalledTimes(1)
233236
expect(mockQdrantClientInstance.createCollection).toHaveBeenCalledTimes(1)
@@ -287,7 +290,10 @@ describe("QdrantVectorStore", () => {
287290
vitest.spyOn(console, "error").mockImplementation(() => {})
288291
vitest.spyOn(console, "warn").mockImplementation(() => {})
289292

290-
await expect(vectorStore.initialize()).rejects.toThrow(deleteError)
293+
// The actual error message includes the URL and error details
294+
await expect(vectorStore.initialize()).rejects.toThrow(
295+
/Failed to connect to Qdrant vector database|vectorStore\.qdrantConnectionFailed/,
296+
)
291297

292298
expect(mockQdrantClientInstance.getCollection).toHaveBeenCalledTimes(1)
293299
expect(mockQdrantClientInstance.deleteCollection).toHaveBeenCalledTimes(1)

0 commit comments

Comments
 (0)