FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(core): wait in test core registry by Tranquility2 · Pull Request #812 · testcontainers/testcontainers-python · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
16 changes: 8 additions & 8 deletions core/tests/test_core_registry.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL