KMongoTestServer
object KMongoTestServer
MongoDB server shared by all the tests of a JVM - the KMongo DSL replacement of kmongo-flapdoodle.
if the
kmongo.test.mongodb.urisystem property (or theKMONGO_TEST_MONGODB_URIenvironment variable) is set, this server is usedelse a MongoDB container (a single node replica set: transactions and change streams are available) is started with Testcontainers at the first use, and stopped at the JVM shutdown. The image can be set with the
kmongo.test.mongodb.imagesystem property (default DEFAULT_IMAGE).
Sample:
val client = KMongo.createClient(KMongoTestServer.connectionString)
val database = client.getDatabase(KMongoTestServer.newDatabaseName())Content copied to clipboard
Properties
Link copied to clipboard
The connection string of the test server (the container is started at the first call).
Link copied to clipboard
The default MongoDB image.
Link copied to clipboard
The system property of the MongoDB image.
Link copied to clipboard
The system property of the external MongoDB server uri.