1
0
Fork 0

Remove Pebble health check container and replace with Python-based health check in E2E tests

This commit is contained in:
Joao Gilberto Magalhaes 2026-02-16 13:18:35 -05:00
parent b867bb724d
commit 1493beb227
2 changed files with 29 additions and 21 deletions

View file

@ -64,22 +64,6 @@ services:
networks: networks:
- acme-test - acme-test
# Pebble health check sidecar
pebble_health:
image: curlimages/curl:8.6.0
depends_on:
- pebble
healthcheck:
test: ["CMD", "curl", "-skf", "https://pebble:14000/dir"]
interval: 2s
timeout: 5s
start_period: 20s # Extended startup window for slow CI
retries: 30 # Increased retries for CI reliability
networks:
- acme-test
restart: "no"
command: ["tail", "-f", "/dev/null"]
# Backend web server # Backend web server
backend: backend:
image: byjg/static-httpserver image: byjg/static-httpserver
@ -98,10 +82,8 @@ services:
context: ../.. context: ../..
dockerfile: build/Dockerfile dockerfile: build/Dockerfile
depends_on: depends_on:
pebble_health: - pebble
condition: service_healthy - backend
backend:
condition: service_started
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "-u", "admin:password", "http://localhost:1936"] test: ["CMD", "curl", "-f", "-u", "admin:password", "http://localhost:1936"]
interval: 10s interval: 10s

View file

@ -34,6 +34,10 @@ import requests
import jwt as jwt_lib import jwt as jwt_lib
from typing import Generator from typing import Generator
from utils import extract_backend_block, DockerComposeFixture from utils import extract_backend_block, DockerComposeFixture
import urllib3
# Disable SSL warnings for Pebble health checks (self-signed certs)
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# Base directory for docker-compose files # Base directory for docker-compose files
BASE_DIR = Path(__file__).parent.absolute() BASE_DIR = Path(__file__).parent.absolute()
@ -843,6 +847,22 @@ class TestChangedLabel:
# Test: docker-compose-acme-e2e.yml - ACME/Certbot with Pebble # Test: docker-compose-acme-e2e.yml - ACME/Certbot with Pebble
# ============================================================================= # =============================================================================
def wait_for_pebble() -> bool:
"""
Health check function to verify Pebble ACME server is ready.
Returns True if Pebble is responding to the /dir endpoint.
This is used instead of Docker healthchecks for more reliable startup
detection in CI environments.
"""
try:
# Pebble uses self-signed certificates, so we need verify=False
response = requests.get("https://127.0.0.1:14000/dir", verify=False, timeout=5)
return response.status_code == 200
except Exception:
return False
@pytest.fixture @pytest.fixture
def docker_compose_acme() -> Generator[None, None, None]: def docker_compose_acme() -> Generator[None, None, None]:
"""Fixture for docker-compose-acme-e2e.yml - ACME/Certbot E2E test""" """Fixture for docker-compose-acme-e2e.yml - ACME/Certbot E2E test"""
@ -858,7 +878,13 @@ def docker_compose_acme() -> Generator[None, None, None]:
stderr=subprocess.DEVNULL # Ignore error if volume doesn't exist stderr=subprocess.DEVNULL # Ignore error if volume doesn't exist
) )
fixture = DockerComposeFixture(str(DOCKER_DIR / "docker-compose-acme-e2e.yml"), startup_wait=0) # Use custom health check for Pebble with generous timeout for CI
fixture = DockerComposeFixture(
str(DOCKER_DIR / "docker-compose-acme-e2e.yml"),
startup_wait=0,
health_check=wait_for_pebble,
health_check_timeout=90 # Extended timeout for slow CI environments
)
fixture.up() fixture.up()
yield yield
fixture.down() fixture.down()