You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
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.
All reactions