File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ def _create_instance(cls) -> "Reaper":
193
193
.with_name (f"testcontainers-ryuk-{ SESSION_ID } " )
194
194
.with_exposed_ports (8080 )
195
195
.with_volume_mapping (RYUK_DOCKER_SOCKET , "/var/run/docker.sock" , "rw" )
196
- .with_kwargs (privileged = RYUK_PRIVILEGED )
196
+ .with_kwargs (privileged = RYUK_PRIVILEGED , auto_remove = True )
197
197
.start ()
198
198
)
199
199
wait_for_logs (Reaper ._container , r".* Started!" )
Original file line number Diff line number Diff line change
1
+ from contextlib import contextmanager
2
+
3
+ import pytest
4
+
1
5
from testcontainers .core import container
2
6
from testcontainers .core .container import Reaper
3
7
from testcontainers .core .container import DockerContainer
4
8
from testcontainers .core .waiting_utils import wait_for_logs
5
9
6
10
11
+ @pytest .mark .skip ("invalid test - ryuk logs 'Removed' right before exiting" )
7
12
def test_wait_for_reaper ():
8
13
container = DockerContainer ("hello-world" ).start ()
9
14
wait_for_logs (container , "Hello from Docker!" )
@@ -17,8 +22,16 @@ def test_wait_for_reaper():
17
22
Reaper .delete_instance ()
18
23
19
24
25
+ @contextmanager
26
+ def reset_reaper_instance ():
27
+ old_value = Reaper ._instance
28
+ Reaper ._instance = None
29
+ yield
30
+ Reaper ._instance = old_value
31
+
32
+
20
33
def test_container_without_ryuk (monkeypatch ):
21
34
monkeypatch .setattr (container , "RYUK_DISABLED" , True )
22
- with DockerContainer ("hello-world" ) as cont :
35
+ with reset_reaper_instance (), DockerContainer ("hello-world" ) as cont :
23
36
wait_for_logs (cont , "Hello from Docker!" )
24
37
assert Reaper ._instance is None
You can’t perform that action at this time.
0 commit comments