testcontainers-spring-boot icon indicating copy to clipboard operation
testcontainers-spring-boot copied to clipboard

feat(embedded-mongodb): add support to launch mongo as a replicaset

Open metron2 opened this issue 3 weeks ago • 1 comments

My team is using mongo change streams for more and more things, but it's a little difficult to make test containers launch mongod as a replicaset. I saw there was an open issue for this #1182 so hopefully people are interested.

The documentation for the mongo container is really sparse on how to do this, so if nothing else this will help others. I included some test and cleaned-up the mongo stuff a little too.

Thanks for this fantastic project.

metron2 avatar Dec 06 '25 20:12 metron2

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 100.00%. Comparing base (074d7cd) to head (75b7640). :warning: Report is 1 commits behind head on develop.

Additional details and impacted files
@@               Coverage Diff               @@
##             develop     #2698       +/-   ##
===============================================
+ Coverage      82.03%   100.00%   +17.96%     
+ Complexity       685        19      -666     
===============================================
  Files            205         5      -200     
  Lines           3111        70     -3041     
  Branches         144         2      -142     
===============================================
- Hits            2552        70     -2482     
+ Misses           489         0      -489     
+ Partials          70         0       -70     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Dec 08 '25 16:12 codecov[bot]