Skip to content

Real testcontainers tests for MongoDB Atlas Vector Search + async-first guard — #829 - #835

Merged
AmitoVrito merged 5 commits into
mainfrom
feat/issue-829-testcontainers-mongodb
Jul 21, 2026
Merged

AmitoVrito merged 5 commits into
mainfrom
feat/issue-829-testcontainers-mongodb

Conversation

@AmitoVrito

Copy link
Copy Markdown
Collaborator

Summary

Next in epic #829: MongoDB Atlas Vector Search, plus an async-first contract guard across the vector stores.

MongoDB

Converted to real testcontainers tests against mongodb/mongodb-atlas-local (actual $vectorSearch — the plain mongo image can't do vector search). The test harness handles what a mock can't: out-of-band vector-search-index creation, waiting for the search service (mongot) to come up + the index to become queryable, and polling for Atlas eventual consistency before asserting.

Result: MongoDBAtlasVectorStore is correct end-to-end — real kNN nearest-neighbour ranking, native $vectorSearch metadata filter, reconnect persistence — no code change needed (deep testing confirms correctness, not just finds bugs). Removes the MagicMock test.

Async-first guard

Per the async-first invariant, adds an iscoroutinefunction assertion on add/search for the pgvector, redis, es, and mongo stores so a future change can't silently desugar the public IO surface to sync.

Verification (real data)

5/5 Mongo tests pass against real Atlas Local vector search (real inserts + real $vectorSearch, ~22s). Wired into the CI integration job.

Commits

  • test(retrieval): real MongoDB Atlas Vector Search testcontainers tests (#829)
  • test(retrieval): assert async-first contract in vector-store integration tests
  • ci(test): add pymongo to the integration group and mongo test to CI (#829)

Part of #829.

#829)

Replace the MagicMock MongoDBAtlasVectorStore test with real coverage against the
mongodb/mongodb-atlas-local image (actual $vectorSearch). Handles the Atlas
specifics the mock couldn't: out-of-band vector search index creation, waiting for
the search service (mongot) to come up and the index to become queryable, and
polling for eventual consistency before asserting. Confirms the store is correct
end-to-end (true kNN ranking, metadata filter, reconnect persistence) — no code
change needed. Also asserts the async-first contract (add/search are coroutines).

Part of #829.
…ion tests

SynapseKit is async-first; lock it in with an iscoroutinefunction assertion on
add/search for the pgvector, redis, and elasticsearch stores so a future change
can't silently desugar the public IO surface to sync.

Part of #829.
…tests

The atlas-local single-node replica set briefly steps down / restarts when its
search service (mongot) first initializes, so the first operation after index
creation could hit NotPrimaryError ("interrupted at shutdown") in CI. Retry
inserts and searches on transient PyMongoError — a startup artifact of the local
image, not a store issue (real Atlas doesn't restart mid-use).

Part of #829.
…stability

CI's atlas-local is more unstable than local during mongot init: any op can hit
NotPrimary / "Error connecting to Search Index Management service" (125) while the
single-node replica set steps down. Make every server op transient-tolerant via a
shared retry helper, and warm mongot up once in the fixture so the one-time
step-down is absorbed before any test runs.

Part of #829.
@AmitoVrito
AmitoVrito merged commit 7a3459b into main Jul 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant