Support parallel initialization of Testcontainers

Add support for a `spring.testcontainers.startup` property that can
be set to "sequential" or "parallel" to change how containers are
started.

Closes gh-37073
This commit is contained in:
Phillip Webb
2023-10-14 23:44:45 -07:00
parent 1edd1d5078
commit 4c3a0f09d7
11 changed files with 293 additions and 16 deletions

View File

@@ -47,4 +47,6 @@ include::application-properties/devtools.adoc[]
include::application-properties/docker-compose.adoc[]
include::application-properties/testcontainers.adoc[]
include::application-properties/testing.adoc[]

View File

@@ -1072,6 +1072,9 @@ include::code:test/MyContainersConfiguration[]
NOTE: The lifecycle of `Container` beans is automatically managed by Spring Boot.
Containers will be started and stopped automatically.
TIP: You can use the configprop:spring.testcontainers.startup[] property to change how containers are started.
By default `sequential` startup is used, but you may also choose `parallel` if you wish to start multiple containers in parallel.
Once you have defined your test configuration, you can use the `with(...)` method to attach it to your test launcher:
include::code:test/TestMyApplication[]