Skip to content

Commit 12a8722

Browse files
committed
move docs to garbage_collector/#terminate-function
1 parent f4c786f commit 12a8722

File tree

2 files changed

+39
-38
lines changed

2 files changed

+39
-38
lines changed

docs/features/common_functional_options.md

-38
Original file line numberDiff line numberDiff line change
@@ -165,41 +165,3 @@ The above example is updating the predefined command of the image, **appending**
165165

166166
!!!info
167167
This can't be used to replace the command, only to append options.
168-
169-
#### NewTerminateOptions
170-
171-
- Since testcontainers-go <a href="https://github.com/testcontainers/testcontainers-go/releases/tag/v0.35.0"><span class="tc-version">:material-tag: v0.35.0</span></a>
172-
173-
If you want to attach option to container termination, you can use the `testcontainer.NewTerminateOptions(ctx context.Context, opts ...TerminateOption) *TerminateOptions` option, which receives a TerminateOption as parameter, creating custom termination options to be passed on the container termination.
174-
175-
##### Terminate Options
176-
177-
###### [StopContext](../../cleanup.go)
178-
Sets the context for the Container termination.
179-
180-
- **Function**: `StopContext(ctx context.Context) TerminateOption`
181-
- **Default**: The context passed in `Terminate()`
182-
- **Usage**:
183-
```go
184-
err := container.Terminate(ctx,StopContext(context.Background()))
185-
```
186-
187-
###### [StopTimeout](../../cleanup.go)
188-
Sets the timeout for stopping the Container.
189-
190-
- **Function**: ` StopTimeout(timeout time.Duration) TerminateOption`
191-
- **Default**: 10 seconds
192-
- **Usage**:
193-
```go
194-
err := container.Terminate(ctx, StopTimeout(20 * time.Second))
195-
```
196-
197-
###### [RemoveVolumes](../../cleanup.go)
198-
Sets the volumes to be removed during Container termination.
199-
200-
- **Function**: ` RemoveVolumes(volumes ...string) TerminateOption`
201-
- **Default**: Empty (no volumes removed)
202-
- **Usage**:
203-
```go
204-
err := container.Terminate(ctx, RemoveVolumes("vol1", "vol2"))
205-
```

docs/features/garbage_collector.md

+39
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,45 @@ The primary method is to use the `Terminate(context.Context)` function that is
1717
available when a container is created. Use `defer` to ensure that it is called
1818
on test completion.
1919

20+
#### NewTerminateOptions
21+
22+
- Since testcontainers-go <a href="https://github.com/testcontainers/testcontainers-go/releases/tag/v0.35.0"><span class="tc-version">:material-tag: v0.35.0</span></a>
23+
24+
If you want to attach option to container termination, you can use the `testcontainer.NewTerminateOptions(ctx context.Context, opts ...TerminateOption) *TerminateOptions` option, which receives a TerminateOption as parameter, creating custom termination options to be passed on the container termination.
25+
26+
##### Terminate Options
27+
28+
###### [StopContext](../../cleanup.go)
29+
Sets the context for the Container termination.
30+
31+
- **Function**: `StopContext(ctx context.Context) TerminateOption`
32+
- **Default**: The context passed in `Terminate()`
33+
- **Usage**:
34+
```go
35+
err := container.Terminate(ctx,StopContext(context.Background()))
36+
```
37+
38+
###### [StopTimeout](../../cleanup.go)
39+
Sets the timeout for stopping the Container.
40+
41+
- **Function**: ` StopTimeout(timeout time.Duration) TerminateOption`
42+
- **Default**: 10 seconds
43+
- **Usage**:
44+
```go
45+
err := container.Terminate(ctx, StopTimeout(20 * time.Second))
46+
```
47+
48+
###### [RemoveVolumes](../../cleanup.go)
49+
Sets the volumes to be removed during Container termination.
50+
51+
- **Function**: ` RemoveVolumes(volumes ...string) TerminateOption`
52+
- **Default**: Empty (no volumes removed)
53+
- **Usage**:
54+
```go
55+
err := container.Terminate(ctx, RemoveVolumes("vol1", "vol2"))
56+
```
57+
58+
2059
!!!tip
2160

2261
Remember to `defer` as soon as possible so you won't forget. The best time

0 commit comments

Comments
 (0)