e7850dc465
tracker-policy-pr / check-pr (pull_request) Successful in 13s
test / integration-docker (pull_request) Successful in 27s
test / unit (pull_request) Successful in 37s
lint / lint (push) Successful in 43s
test / integration-firecracker (pull_request) Successful in 4s
test / coverage (pull_request) Has been cancelled
Docker integration tests are already covered by the integration-docker job on ubuntu-latest. On the KVM runner the Firecracker TAP/nftables pool conflicts with Docker networking, causing those tests to hang and the coverage job to never complete. Add SKIP_DOCKER_TESTS env-var support to docker_available() and set it for the integration phase of coverage.sh so only Firecracker integration tests run there.
33 lines
777 B
Python
33 lines
777 B
Python
"""Docker availability check used by integration tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import unittest
|
|
|
|
|
|
def docker_available() -> bool:
|
|
if os.environ.get("SKIP_DOCKER_TESTS"):
|
|
return False
|
|
if shutil.which("docker") is None:
|
|
return False
|
|
try:
|
|
return (
|
|
subprocess.run(
|
|
["docker", "info"],
|
|
stdout=subprocess.DEVNULL,
|
|
stderr=subprocess.DEVNULL,
|
|
check=False,
|
|
timeout=5,
|
|
).returncode
|
|
== 0
|
|
)
|
|
except subprocess.TimeoutExpired:
|
|
return False
|
|
|
|
|
|
def skip_unless_docker(reason: str = "docker unreachable"):
|
|
return unittest.skipUnless(docker_available(), reason)
|