fix: skip Docker tests gracefully when daemon is unavailable
The docker_stack fixture now checks `docker info` before attempting `compose up`. If the daemon isn't reachable, tests skip instead of erroring with pytest.fail. https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
This commit is contained in:
@@ -163,6 +163,13 @@ def docker_stack():
|
||||
if os.environ.get("FUNCTIONAL_DOCKER") != "1":
|
||||
pytest.skip("Set FUNCTIONAL_DOCKER=1 to run Docker tests")
|
||||
|
||||
# Verify Docker daemon is reachable before attempting build
|
||||
docker_check = subprocess.run(
|
||||
["docker", "info"], capture_output=True, text=True, timeout=10,
|
||||
)
|
||||
if docker_check.returncode != 0:
|
||||
pytest.skip(f"Docker daemon not available: {docker_check.stderr.strip()}")
|
||||
|
||||
result = _compose("up", "-d", "--build", "--wait", timeout=300)
|
||||
if result.returncode != 0:
|
||||
pytest.fail(f"docker compose up failed:\n{result.stderr}")
|
||||
|
||||
Reference in New Issue
Block a user