Skip to content

Conversation

@dcoric
Copy link
Contributor

@dcoric dcoric commented Feb 4, 2026

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

  • Adds integration test coverage for MongoDB operations
  • Test infrastructure with automatic setup/teardown and database cleanup
  • CI integration running tests across MongoDB 6.0, 7.0, and 8.0
  • Enhanced database helper with connection management utilities
  • Documentation for running integration tests locally with Docker

Running Locally

Integration tests require MongoDB running on localhost:27017. The connection string is configured in vitest.config.integration.ts.

# Start MongoDB with Docker
docker run -d --name mongodb-test -p 27017:27017 mongo:7

# Run integration tests
npm run test:integration

# Cleanup
docker stop mongodb-test && docker rm mongodb-test

The RUN_MONGO_TESTS environment 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-action in the build matrix (versions 6.0, 7.0, 8.0), so the tests execute against the existing MongoDB instance.

The CI step simply runs:

- name: MongoDB Integration Tests
  env:
    RUN_MONGO_TESTS: 'true'
  run: npm run test:integration

Configuration

Connection string is set in vitest.config.integration.ts:

  • Local/CI: mongodb://localhost:27017/git-proxy-test
  • Database: git-proxy-test (isolated from development data)
  • Config file: test-integration.proxy.config.json (loaded via CONFIG_FILE env var)

Benefits

  • Validates real database operations against live MongoDB
  • Runs automatically in CI across all MongoDB versions in the test matrix
  • Uses isolated test database to avoid conflicts with development data
  • Clean test isolation with automatic cleanup between tests

@netlify
Copy link

netlify bot commented Feb 4, 2026

Deploy Preview for endearing-brigadeiros-63f9d0 ready!

Name Link
🔨 Latest commit 2290c99
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/6983330bf2057f000837aeb1
😎 Deploy Preview https://deploy-preview-1382.git-proxy.preview.finos.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dcoric dcoric changed the title Add MongoDB integration tests with CI support feat: Add MongoDB integration tests with CI support Feb 4, 2026
@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.26%. Comparing base (4a738dc) to head (2290c99).

Files with missing lines Patch % Lines
src/db/mongo/helper.ts 25.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1382      +/-   ##
==========================================
- Coverage   81.35%   81.26%   -0.10%     
==========================================
  Files          65       65              
  Lines        4639     4648       +9     
  Branches      792      792              
==========================================
+ Hits         3774     3777       +3     
- Misses        850      856       +6     
  Partials       15       15              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dcoric dcoric self-assigned this Feb 4, 2026
@dcoric dcoric requested review from jescalada and kriswest February 4, 2026 11:55
@grovesy
Copy link
Member

grovesy commented Feb 4, 2026

@kriswest - Reviewed, looks good to me. Happy to close.

-Paul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set-up testing of the mongo DB client

2 participants