Establish automated test suite for OPEA microservices (resolves #518)
Automated Test Suite for OPEA Microservices
Context
Issue #518 identified that there are zero automated tests for any microservice. As agentic workflows and GovStack integrations are added, the combinatorial explosion of failure modes makes manual testing impossible.
This issue establishes the testing foundation: framework, CI pipeline, and critical-path contract tests.
Scope
Phase 1: Test Framework Setup
- Add
pytest+pytest-asyncio+httpxto all OPEA microservices - Create
tests/directory structure per service - Add
conftest.pywith shared fixtures (test client, mock services, test data) - Configure CI pipeline to run tests on merge requests
Phase 2: Contract Tests (Critical Path)
-
ChatQnA: Test
/v1/chat/completions— valid request, streaming, error cases, translation toggle -
Retriever: Test
/v1/retrieval— vector search, graph traversal, score thresholding -
Dataprep: Test
/v1/dataprep/ingest— file upload, chunking, ArangoDB write -
Reranker: Test
/v1/reranking— valid input, empty results, threshold filtering
Phase 3: Integration Tests
- Test the full RAG pipeline: ingest → retrieve → rerank → generate
- Use testcontainers or Docker Compose test profile for ArangoDB dependency
- Mock vLLM/TEI external calls for CI (too heavy for CI otherwise)
Acceptance Criteria
-
All 4 microservices have pytest configured with CI integration -
Contract tests cover happy path + error cases for each endpoint -
Integration test runs the full RAG pipeline (ingest → query → response) -
CI pipeline runs tests on every merge request -
Test coverage report generated (target: >60% on new code)
Related Issues
- Resolves: #518 (P2)
- Blocks: Agentic workflow testing (Sprint 24)
Labels
testing, enhancement, 1.Parent_Issue