Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions core/tests/test_core_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from testcontainers.core.config import testcontainers_config
from testcontainers.core.container import DockerContainer
from testcontainers.core.docker_client import DockerClient
from testcontainers.core.waiting_utils import wait_container_is_ready
from testcontainers.core.waiting_utils import wait_for_logs

from testcontainers.registry import DockerRegistryContainer
from testcontainers.core.utils import is_mac
Expand Down Expand Up @@ -43,22 +43,22 @@ def test_missing_on_private_registry(monkeypatch):
with pytest.raises(NotFound):
# Test a container with image from private registry
with DockerContainer(f"{registry_url}/{image}:{tag}") as test_container:
wait_container_is_ready(test_container)
wait_for_logs(test_container, "Hello from Docker!")


@pytest.mark.skipif(
is_mac(),
reason="Docker Desktop on macOS does not support local insecure registries over HTTP without modifying daemon settings",
)
@pytest.mark.parametrize(
"image,tag,username,password",
"image,tag,username,password,expected_output",
[
("nginx", "test", "user", "pass"),
("hello-world", "latest", "new_user", "new_pass"),
("alpine", "3.12", None, None),
("nginx", "test", "user", "pass", "start worker processes"),
("hello-world", "latest", "new_user", "new_pass", "Hello from Docker!"),
("alpine", "3.12", None, None, ""),
],
)
def test_with_private_registry(image, tag, username, password, monkeypatch):
def test_with_private_registry(image, tag, username, password, expected_output, monkeypatch):
client = DockerClient().client

with DockerRegistryContainer(username=username, password=password) as registry:
Expand All @@ -85,7 +85,7 @@ def test_with_private_registry(image, tag, username, password, monkeypatch):

# Test a container with image from private registry
with DockerContainer(f"{registry_url}/{image}:{tag}") as test_container:
wait_container_is_ready(test_container)
wait_for_logs(test_container, expected_output)

# cleanup
client.images.remove(f"{registry_url}/{image}:{tag}")
Expand Down