15
15
from testcontainers .core .config import testcontainers_config
16
16
from testcontainers .core .container import DockerContainer
17
17
from testcontainers .core .docker_client import DockerClient
18
- from testcontainers .core .waiting_utils import wait_container_is_ready
18
+ from testcontainers .core .waiting_utils import wait_for_logs
19
19
20
20
from testcontainers .registry import DockerRegistryContainer
21
21
from testcontainers .core .utils import is_mac
@@ -43,22 +43,22 @@ def test_missing_on_private_registry(monkeypatch):
43
43
with pytest .raises (NotFound ):
44
44
# Test a container with image from private registry
45
45
with DockerContainer (f"{ registry_url } /{ image } :{ tag } " ) as test_container :
46
- wait_container_is_ready (test_container )
46
+ wait_for_logs (test_container , "Hello from Docker!" )
47
47
48
48
49
49
@pytest .mark .skipif (
50
50
is_mac (),
51
51
reason = "Docker Desktop on macOS does not support local insecure registries over HTTP without modifying daemon settings" ,
52
52
)
53
53
@pytest .mark .parametrize (
54
- "image,tag,username,password" ,
54
+ "image,tag,username,password,expected_output " ,
55
55
[
56
- ("nginx" , "test" , "user" , "pass" ),
57
- ("hello-world" , "latest" , "new_user" , "new_pass" ),
58
- ("alpine" , "3.12" , None , None ),
56
+ ("nginx" , "test" , "user" , "pass" , "start worker processes" ),
57
+ ("hello-world" , "latest" , "new_user" , "new_pass" , "Hello from Docker!" ),
58
+ ("alpine" , "3.12" , None , None , "" ),
59
59
],
60
60
)
61
- def test_with_private_registry (image , tag , username , password , monkeypatch ):
61
+ def test_with_private_registry (image , tag , username , password , expected_output , monkeypatch ):
62
62
client = DockerClient ().client
63
63
64
64
with DockerRegistryContainer (username = username , password = password ) as registry :
@@ -85,7 +85,7 @@ def test_with_private_registry(image, tag, username, password, monkeypatch):
85
85
86
86
# Test a container with image from private registry
87
87
with DockerContainer (f"{ registry_url } /{ image } :{ tag } " ) as test_container :
88
- wait_container_is_ready (test_container )
88
+ wait_for_logs (test_container , expected_output )
89
89
90
90
# cleanup
91
91
client .images .remove (f"{ registry_url } /{ image } :{ tag } " )
0 commit comments