Skip to content

Commit f9dabb6

Browse files
authored
Polish reuse documentation (#7316)
1 parent 1835f97 commit f9dabb6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

docs/features/reuse.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
Reusable Containers is still an experimental feature and the behavior can change.
55
Those containers won't stop after all tests are finished.
66

7-
The *Reusable Containers* feature keeps the containers running between test sessions. In order
8-
to use it, manual container lifecycle instrumentation should be used by calling the `start()` method
9-
and it needs to be manually enabled through an opt-in mechanism. In order to reuse a container, the
10-
configuration of the container *must not change*.
7+
The *Reusable* feature keeps the containers running and next executions with the same container configuration
8+
will reuse it. To use it, start the container manually by calling `start()` method, do not call `stop()` method
9+
directly or indirectly via `try-with-resources` or `JUnit integration`, and enable it manually through an
10+
opt-in mechanism per environment. To reuse a container, the container configuration **must be the same**.
1111

1212
!!! note
1313
Reusable containers are not suited for CI usage and as an experimental feature
@@ -16,18 +16,19 @@ configuration of the container *must not change*.
1616

1717
## How to use it
1818

19-
* Define a container with `withReuse(true)`
19+
* Enable `Reusable Containers` in `~/.testcontainers.properties`, by adding `testcontainers.reuse.enable=true`
20+
* Define a container and subscribe to reuse the container using `withReuse(true)`
2021

2122
```java
2223
GenericContainer container = new GenericContainer("redis:6-alpine")
2324
.withExposedPorts(6379)
2425
.withReuse(true)
2526
```
2627

27-
* Opt-in to Reusable Containers in `~/.testcontainers.properties`, by adding `testcontainers.reuse.enable=true`
28-
* Containers need to be started manually using `container.start()`. See [docs](../../test_framework_integration/manual_lifecycle_control)
28+
* Start the container manually by using `container.start()`
2929

3030
### Reusable Container with Testcontainers JDBC URL
3131

3232
If using the [Testcontainers JDBC URL support](../../modules/databases/jdbc#database-containers-launched-via-jdbc-url-scheme)
33-
the URL **must** follow the pattern of `jdbc:tc:mysql:5.7.34:///databasename?TC_REUSABLE=true`. `TC_REUSABLE=true` is set as a parameter of the JDBC URL.
33+
the URL **must** follow the pattern of `jdbc:tc:mysql:5.7.34:///databasename?TC_REUSABLE=true`.
34+
`TC_REUSABLE=true` is set as a parameter of the JDBC URL.

0 commit comments

Comments
 (0)