Commit 3e783a8
authored
fix(core): multiple container start invocations with custom labels (#769)
When invoking `.start()` multiple times on the same `DockerContainer`
instance, the call fails with `ValueError: The org.testcontainers
namespace is reserved for internal use` error.
Example code:
```
from testcontainers.core.container import DockerContainer
container = DockerContainer("alpine:latest").with_kwargs(labels={})
container.start()
container.stop()
container.start()
```
The fix is to update labels for the container in a copy of the
user-provided dictionary, so that:
* the code doesn't mutate user structures
* avoid side effects, allowing for multiple .start() invocations1 parent 9317736 commit 3e783a8
2 files changed
+16
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | | - | |
| 32 | + | |
30 | 33 | | |
31 | | - | |
32 | | - | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
0 commit comments