feat: Add MongoDB integration tests with CI support #1382
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
Adds comprehensive MongoDB integration tests for the database layer (repos, users, pushes) with CI integration. Tests run against a real MongoDB instance to validate database operations beyond unit test coverage.
Fixes #1168
What's New
Running Locally
Integration tests require MongoDB running on
localhost:27017. The connection string is configured invitest.config.integration.ts.The
RUN_MONGO_TESTSenvironment variable is automatically set by the vitest config, but can be overridden if needed.Running in CI
Integration tests run automatically in the CI pipeline after unit tests. MongoDB is already started via
supercharge/mongodb-github-actionin the build matrix (versions 6.0, 7.0, 8.0), so the tests execute against the existing MongoDB instance.The CI step simply runs:
Configuration
Connection string is set in
vitest.config.integration.ts:mongodb://localhost:27017/git-proxy-testgit-proxy-test(isolated from development data)test-integration.proxy.config.json(loaded viaCONFIG_FILEenv var)Benefits