You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add WithReuseByName for modifying Generic Container Requests (#3064)
* added WithReuse and WithContainerName functions for modifying the
GenericContainerRequest
* Simplify API surface for WithReuse
* docs: document new option
* fix: lint
* chore: rename option to WithReuseByName
* chore: add test for the new option
* chore: simplify test assertions
---------
Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
Copy file name to clipboardExpand all lines: docs/features/common_functional_options.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -302,3 +302,19 @@ The above example is updating the predefined command of the image, **appending**
302
302
303
303
!!!info
304
304
This can't be used to replace the command, only to append options.
305
+
306
+
#### WithReuseByName
307
+
308
+
- Not available until the next release of testcontainers-go <ahref="https://github.com/testcontainers/testcontainers-go"><spanclass="tc-version">:material-tag: main</span></a>
309
+
310
+
This option marks a container to be reused if it exists or create a new one if it doesn't.
311
+
With the current implementation, the container name must be provided to identify the container to be reused.
Copy file name to clipboardExpand all lines: docs/modules/index.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -216,6 +216,7 @@ In order to simplify the creation of the container for a given module, `Testcont
216
216
-`testcontainers.WithHostConfigModifier`: a function that sets the host config Docker type for the container request. Please see [Advanced Settings](../features/creating_container.md#advanced-settings) for more information.
217
217
-`testcontainers.WithEndpointSettingsModifier`: a function that sets the endpoint settings Docker type for the container request. Please see [Advanced Settings](../features/creating_container.md#advanced-settings) for more information.
218
218
-`testcontainers.CustomizeRequest`: a function that merges the default options with the ones provided by the user. Recommended for completely customizing the container request.
219
+
-`testcontainers.WithReuseByName`: a function that marks a container to be reused if it exists or create a new one if it doesn't.
0 commit comments