1
0
Fork 0

Adjust health checks and retry logic in E2E tests for improved CI reliability

This commit is contained in:
Joao Gilberto Magalhaes 2026-02-16 12:13:13 -05:00
parent 4df8666a2b
commit aa518e9686
2 changed files with 7 additions and 7 deletions

View file

@ -71,10 +71,10 @@ services:
- pebble - pebble
healthcheck: healthcheck:
test: ["CMD", "curl", "-skf", "https://pebble:14000/dir"] test: ["CMD", "curl", "-skf", "https://pebble:14000/dir"]
interval: 5s interval: 1s
timeout: 3s timeout: 3s
start_period: 5s start_period: 5s # Sufficient time for CI environments
retries: 3 retries: 20 # Enough retries for slower CI
networks: networks:
- acme-test - acme-test
restart: "no" restart: "no"

View file

@ -932,11 +932,11 @@ class TestACME:
"""Test that Pebble successfully issues a certificate""" """Test that Pebble successfully issues a certificate"""
# Wait for certificate issuance (Certbot runs in background loop) # Wait for certificate issuance (Certbot runs in background loop)
# Typical time: 10-15 seconds from container start # Typical time: 10-15 seconds from container start
max_wait = 30 max_retries = 30
check_interval = 2 check_interval = 1
has_success = False has_success = False
for attempt in range(max_wait // check_interval): for attempt in range(max_retries):
result = subprocess.run( result = subprocess.run(
["docker", "logs", "docker-haproxy-1"], ["docker", "logs", "docker-haproxy-1"],
capture_output=True, capture_output=True,
@ -961,7 +961,7 @@ class TestACME:
# Check if we can at least connect to Pebble # Check if we can at least connect to Pebble
has_pebble_connection = "pebble:14000/dir" in logs or "pebble:14000" in logs has_pebble_connection = "pebble:14000/dir" in logs or "pebble:14000" in logs
assert has_pebble_connection, \ assert has_pebble_connection, \
f"HAProxy cannot connect to Pebble ACME server after {max_wait}s. Check docker network.\nLogs:\n{logs[-2000:]}" f"HAProxy cannot connect to Pebble ACME server after {max_retries}s. Check docker network.\nLogs:\n{logs[-2000:]}"
# Verify merged certificate file exists # Verify merged certificate file exists
# EasyHAProxy merges cert+key from /etc/easyhaproxy/certs/live/ to /etc/easyhaproxy/certs/certbot/{domain}.pem # EasyHAProxy merges cert+key from /etc/easyhaproxy/certs/live/ to /etc/easyhaproxy/certs/certbot/{domain}.pem