Skip to content

Epic: real testcontainers integration tests for all external backends (replace MagicMock) #829

Closed

Description

@AmitoVrito

Summary

Replace mock/MagicMock-based tests for external backends with real testcontainers integration tests, run under the CI integration job added in #827. Right now only Neo4j/Kuzu/property-graph run against real services; every other backend is tested with fakes, respx, or MagicMock — several of which violate the repo testing standard ("NO MagicMock/Mock anywhere") and give false confidence (this is exactly how the #826 Neo4j parity bug reached main).

Each conversion: spin up the real service via testcontainers, exercise the real client path, and delete the MagicMock. Add the client + testcontainers module to the integration dependency-group and ensure the file is covered by the integration CI job.

Why

Backends to convert

P0 — highest usage (start here)

P1 — common search/doc stores

P2 — long tail

Definition of done (per backend)

  • Real testcontainers test exercising the real client (add/search/delete or equivalent round-trip).
  • MagicMock/Mock/mocker.patch removed from that backend's tests.
  • Client lib + any testcontainers extra added to the integration group; file runs in the integration CI job and is green.
  • Follows testing standards: pytest, no mocks, negative cases.

Tracking

Convert in PRs per backend group (P0 first). This epic tracks progress; each PR closes its own item.


New tracks (added after survey — loaders & LLM providers have zero testcontainers today; loaders are 35 MagicMock files, LLM providers 23)

Loaders (containerizable → real testcontainers)

LLM providers


Status of remaining LLM providers (after core completion)

  • OpenAI-compatible clones (Groq, DeepSeek, xAI, Cerebras, Fireworks, Together, Novita, Writer, Moonshot, …): share OpenAILLM's code path (AsyncOpenAI + base_url) — already covered by the OpenAI respx pattern; per-provider respx is redundant. Good-first-issue if per-provider assurance is wanted.
  • Distinct-SDK providers:
    • Gemini — old google.generativeai SDK streams over gRPC; respx (httpx-only) can't intercept it. Needs a REST-transport path or a different approach. Deferred.
    • Cohere, Mistral — httpx-based; respx-able with per-SDK wire-format work. Good follow-ups.
    • Bedrock — boto3; could use moto/LocalStack. Deferred.
  • Local: Ollama done (real inference). llamacpp/gpt4all need a GGUF model file; vllm needs a GPU — optional.

These are tracked follow-ups; the epic's core (real testcontainers for every external backend + LLM foundation) is complete.

Activity

  1. added this to the v2.0.1 milestone on Jul 21, 2026
  2. added
    v2.0.1
    on Jul 21, 2026
  3. AmitoVrito commented on Jul 21, 2026

    @AmitoVrito
    CollaboratorAuthor

    Progress: pgvector + redis-vector converted to real testcontainers tests in #832. Deep testing surfaced and fixed 7 mock-hidden bugs (#830 pgvector: dimension/register_vector/commit/opclass/JSONB; #831 redis: binary-field decode + reconnect persistence) plus a session-wide sys.modules['redis'] test-isolation leak. Next: P1 vector stores (Elasticsearch → MongoDB → Qdrant).

  4. 17 remaining items

  5. AmitoVrito commented on Jul 22, 2026

    @AmitoVrito
    CollaboratorAuthor

    Core complete ✅

    Real testcontainers now cover every external backend in the framework, replacing MagicMock throughout:

    Vector stores (10): pgvector, redis, elasticsearch, qdrant, weaviate, milvus (Lite), cassandra, clickhouse, opensearch, mongodb (Atlas Local)
    Memory + checkpointers (4): postgres/redis memory, postgres/redis graph checkpointers
    Loaders (7): S3 (MinIO), SQL (Postgres), Mongo, Elasticsearch, Redis, DynamoDB (DynamoDB Local), Azure Blob (Azurite)
    LLM: OpenAI + Anthropic (respx HTTP-contract), Ollama (real local inference)

    ~39 real production bugs/gaps fixed — all hidden by mocks — including event-loop-blocking async violations (qdrant/weaviate/milvus), a fully-broken Weaviate v4 path, pgvector's dimension/register_vector/commit/opclass/JSONB set, Milvus schema/index API misuse, Cassandra's list<float>-not-vector, ClickHouse top_k injection, Postgres-memory JSONB decode, and missing endpoint_url/host support that locked out MinIO/R2/LocalStack/DynamoDB-Local/remote-Ollama.

    Every test does real inserts + real queries + reconnect reads, runs in CI (heavy Ollama isolated in its own job), and asserts the async-first contract.

    Deferred (documented): Supabase (needs full hosted PostgREST+JWT+Kong stack), git loader, Gemini (old SDK is gRPC-only → not respx-able), OpenAI-compatible clones (share the OpenAI code path), llamacpp/gpt4all/vllm.

  6. added a commit that references this issue on Jul 31, 2026
  7. added a commit that references this issue on Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    v2.0.1

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions