feat(embedded-mongodb): add support to launch mongo as a replicaset#2698
Conversation
embedded-mongodb/src/main/java/com/playtika/testcontainer/mongodb/MongodbStatusCheck.java
Show resolved
Hide resolved
ijusti
left a comment
There was a problem hiding this comment.
Thanks for contribution, docs and tests
embedded-mongodb/src/main/java/com/playtika/testcontainer/mongodb/MongodbStatusCheck.java
Show resolved
Hide resolved
.../src/main/java/com/playtika/testcontainer/mongodb/EmbeddedMongodbBootstrapConfiguration.java
Show resolved
Hide resolved
embedded-mongodb/src/main/java/com/playtika/testcontainer/mongodb/MongodbWaitStrategy.java
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. 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 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // renovate: datasource=docker | ||
| // https://hub.docker.com/_/mongo | ||
| return "mongodb/mongodb-community-server:8.0.10-ubuntu2204"; | ||
| return "mongodb/mongodb-community-server:8.2.2-ubuntu2204"; |
There was a problem hiding this comment.
update also version in other places metron2@4d635ab
There was a problem hiding this comment.
do not forget add it to readme
998adb3 to
8288d13
Compare
.../src/main/java/com/playtika/testcontainer/mongodb/EmbeddedMongodbBootstrapConfiguration.java
Show resolved
Hide resolved
.../src/main/java/com/playtika/testcontainer/mongodb/EmbeddedMongodbBootstrapConfiguration.java
Show resolved
Hide resolved
| // renovate: datasource=docker | ||
| // https://hub.docker.com/_/mongo | ||
| return "mongodb/mongodb-community-server:8.0.10-ubuntu2204"; | ||
| return "mongodb/mongodb-community-server:8.2.2-ubuntu2204"; |
There was a problem hiding this comment.
do not forget add it to readme
| assertThat(environment.getProperty("embedded.mongodb.port")).isNotEmpty(); | ||
| assertThat(environment.getProperty("embedded.mongodb.host")).isNotEmpty(); | ||
| assertThat(environment.getProperty("embedded.mongodb.username")).isNotEmpty(); | ||
| assertThat(environment.getProperty("embedded.mongodb.password")).isNotEmpty(); | ||
| assertThat(environment.getProperty("embedded.mongodb.database")).isNotEmpty(); | ||
| assertThat(environment.getProperty("embedded.mongodb.replica-set-name")).isNotEmpty(); |
There was a problem hiding this comment.
do not use environment. add fields with spring Value annotation
There was a problem hiding this comment.
I was following the convention of the other test, do you want me to change both of them? I pretty much copied that one and added this line for the replicaset mode.
Co-authored-by: Oleksandr <ijusti@users.noreply.github.com>
Unfortunately the order seems to matter and it doesn't work this way This reverts commit cf07395.
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.