feat(test): add comprehensive multi-database testing infrastructure#18
Merged
feat(test): add comprehensive multi-database testing infrastructure#18
Conversation
- Add multi-container support for MongoDB 4.4, MongoDB 8.0, and DocumentDB - Migrate all existing tests to run against all three databases - Add unicode test suite covering CJK, Arabic, emoji, and special characters - Add complex query tests (nested $and/$or, $elemMatch, cursor modifiers) - Add BSON helper function tests (ObjectId, ISODate, NumberLong, etc.) - Add fuzz tests for edge case discovery - Add shared test fixtures (users, unicode samples, complex documents) - Add fixture loader utility for test data management Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
rebelice
approved these changes
Jan 23, 2026
There was a problem hiding this comment.
Pull request overview
Adds a multi-database integration testing setup (MongoDB 4.4, MongoDB 8.0, and DocumentDB) and expands the test suite to validate behavior across engines, including unicode handling, complex queries, BSON helpers, and fuzzing.
Changes:
- Introduces multi-container test infrastructure and helpers (
GetAllClients,RunOnAllDBs) plus fixture loading utilities. - Migrates existing integration tests to run against all supported databases in parallel subtests.
- Adds new test suites (unicode round-trips, BSON helper coverage, fuzz tests) and new JSON fixtures.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| write_test.go | Migrates write-operation tests to run across all DBs via RunOnAllDBs. |
| error_test.go | Runs error-path tests across all DBs with per-DB database names. |
| database_test.go | Runs database/collection metadata tests across all DBs. |
| collection_test.go | Runs extensive collection/query/aggregate tests across all DBs and adds new query coverage. |
| unicode_test.go | Adds unicode-focused integration tests (CJK/Arabic/emoji, unicode collection names, fixture round-trip). |
| fuzz_test.go | Adds Go fuzz tests for filters and inserts (integration-level). |
| internal/testutil/container.go | Implements multi-container startup (mongo4/mongo8/documentdb) and test helper APIs. |
| internal/testutil/container_test.go | Adds tests validating the multi-container helper behavior and fixture loading. |
| internal/testutil/fixtures.go | Adds JSON fixture loader utilities for tests. |
| internal/translator/bson_helpers_test.go | Adds end-to-end tests for BSON helper function conversions. |
| testdata/users.json | Adds user fixture data. |
| testdata/unicode_samples.json | Adds unicode fixture data for round-trip testing. |
| testdata/complex_documents.json | Adds complex document fixture data for advanced query coverage. |
| go.mod | Promotes testcontainers-go to a direct dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Pin DocumentDB image to version 1.0.0
- Fix port spec consistency ("10260/tcp")
- Add slices.SortFunc for stable DB ordering
- Add ping verification to setupMongoDB
- Require all 3 DBs in TestMultiContainer
- Fix distinct test to assert both values explicitly
- Remove fuzz tests
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
010cb4f to
3c78f66
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
testutil.RunOnAllDBs$and/$or,$elemMatch, cursor modifiers)Test plan
🤖 Generated with Claude Code