Skip to content
Bluetape4k docs1.11

Testing, operations, and ecosystem

Latest stable Based on Bluetape4k release 1.11.0

AbstractReactiveMongoTest lazily starts a MongoDBServer Testcontainer and registers spring.data.mongodb.uri dynamically. AbstractReactiveMongoCoroutineTest adds a test scope with Dispatchers.IO and a CoroutineName.

ReactiveMongoOperationsCoroutinesTest uses a real Spring Boot context and MongoDB to verify:

  • insert and save;
  • Flow, optional, and required reads;
  • count and exists;
  • update-first, update-multi, and upsert;
  • remove, find-and-modify, and find-and-remove;
  • distinct and aggregation;
  • collection existence, creation, and removal.

The three query-DSL test classes compare BSON structures without a server. Run the fast DSL checks first, then serialize the Docker-backed suite with other Testcontainers work.

The integration suite uses the dedicated test_users collection. Give each test a unique business key such as email and remove only documents created by that test. Assertions against a shared collection’s absolute count are sensitive to execution order and parallelism.

Terminal window
./gradlew :bluetape4k-spring-boot-mongodb:test \
--no-build-cache --no-configuration-cache

The module adds no metrics, so use Spring Boot and MongoDB driver observation.

SignalPossible problem
Server-selection timeTopology change, DNS/network issues, no primary
Pool wait and in-use connectionsPool exhaustion, long query, slow Flow consumer
Command latency and error codeMissing index, timeout, duplicate key, write concern
Cancellation and request latencyClient disconnect, deadline, excessive result size
Active subscriptions during shutdownTailable cursor or coroutine scope not closed
NeedStarting point
Spring Data mapping, ReactiveMongoOperations, and coroutinesThis module
Spring Data repository interfaceSpring Data reactive/coroutine repository
Direct MongoDB Kotlin driver, codec, and collection controlbluetape4k-mongodb
Spring Boot client, properties, and health configurationSpring Boot MongoDB auto-configuration

Both bluetape4k modules can be present, but avoid casually mixing Spring Data mapping and native codec mapping in one repository. Assign document wire format and transaction/session ownership to one clear layer.

After choosing the layer, return to Auto-configuration and ownership boundaries and pin the beans and settings owned by the application.