Replies: 2 comments
-
@luketn can you help us? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Suggested PR: #10034 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to use MongoDBAtlasLocalContainer in my SpringBoot tests. I'm writing a new class inspired by MongoContainerConnectionDetailsFactory which allows Spring Boot tests to use the @ServiceContext annotation to auto-populate spring properties which are being picked up by my application. I am planning to contribute this code to the spring project, but it is not working out of the box because of how MongoDBAtlasLocalContainer exposes data.
When looking at MongoContainerConnectionDetailsFactory, it uses the method getReplicaSetUrl from MongoDBContainer, which includes the database name in the connection string (by default "test"), i.e.
mongodb://localhost:<port>/test
.There is no method in MongoDBAtlasLocalContainer which exposes a connection string including that same (default) database, rather we get
mongodb://localhost:<port>/?directConnection=true
.The consequence is that I cannot easily write an alike MongoContainerConnectionDetailsFactory so I can use @ServiceContext, since it expects the database to be filled in (getting an error without, complaining the database cannot be null).
I've the change ready on a local branch and will post shortly.
Beta Was this translation helpful? Give feedback.
All reactions