Skip to content

Latest commit

 

History

History
50 lines (40 loc) · 1.57 KB

File metadata and controls

50 lines (40 loc) · 1.57 KB

embedded-mongodb

Maven dependency

pom.xml
<dependency>
    <groupId>com.playtika.testcontainers</groupId>
    <artifactId>embedded-mongodb</artifactId>
    <scope>test</scope>
</dependency>

Consumes (via bootstrap.properties)

  • embedded.mongodb.enabled (true|false, default is true)

  • embedded.mongodb.reuseContainer (true|false, default is false)

  • embedded.mongodb.dockerImage (default is 'mongodb/mongodb-community-server:7.0.12-ubuntu2204')

  • embedded.mongodb.host (default is localhost)

  • embedded.mongodb.port (default is 27017)

  • embedded.mongodb.username

  • embedded.mongodb.password

  • embedded.mongodb.database (default is test)

  • embedded.toxiproxy.proxies.mongodb.enabled Enables both creation of the container with ToxiProxy TCP proxy and a proxy to the embedded-mongodb container.

Produces

  • embedded.mongodb.host

  • embedded.mongodb.port

  • embedded.mongodb.username

  • embedded.mongodb.password

  • embedded.mongodb.database

  • embedded.mongodb.toxiproxy.host

  • embedded.mongodb.toxiproxy.port

  • embedded.mongodb.networkAlias

  • embedded.mongodb.internalPort

  • Bean ToxiproxyContainer.ContainerProxy mongodbContainerProxy

Example

To auto-configure spring-data-mongodb use these properties in your test application.properties:

/src/test/resources/application.properties
spring.data.mongodb.uri=mongodb://${embedded.mongodb.host}:${embedded.mongodb.port}/${embedded.mongodb.database}