Skip to content

Commit

Permalink
Transitions to use pytest-docker for managed services (fixes)
Browse files Browse the repository at this point in the history
  • Loading branch information
stumpylog committed Oct 9, 2024
1 parent bc9bcce commit 01501be
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 14 deletions.
13 changes: 1 addition & 12 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,12 @@ def webserver_service_name() -> str:

@pytest.fixture(scope="session")
def gotenberg_host(docker_services, docker_ip: str, gotenberg_service_name: str) -> str:
def is_responsive(url):
import httpx

try:
response = httpx.get(url)
except httpx.HTTPError:
logger.exception("Error connecting to service")
return False
else:
return response.status_code == httpx.codes.OK

url = f"http://{docker_ip}:{docker_services.port_for(gotenberg_service_name, 3000)}"

docker_services.wait_until_responsive(
timeout=30.0,
pause=1,
check=lambda: is_responsive(url),
check=lambda: is_responsive(f"{url}/version"),
)
return url

Expand Down
1 change: 0 additions & 1 deletion tests/docker/docker-compose.ci-test-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ services:
image: docker.io/nginx:1-alpine
ports:
- "80/tcp"
restart: unless-stopped
volumes:
- ./content:/usr/share/nginx/html:ro
1 change: 0 additions & 1 deletion tests/docker/docker-compose.ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ services:
image: docker.io/nginx:1-alpine
ports:
- "80/tcp"
restart: unless-stopped
volumes:
- ./content:/usr/share/nginx/html:ro

0 comments on commit 01501be

Please sign in to comment.