fix(docker): fail closed on bottle enumeration
lint / lint (push) Successful in 1m2s
test / integration-docker (pull_request) Failing after 56s
test / image-input-builds (pull_request) Successful in 57s
test / unit (pull_request) Successful in 1m3s
test / coverage (pull_request) Has been skipped
tracker-policy-pr / check-pr (pull_request) Successful in 11s
lint / lint (push) Successful in 1m2s
test / integration-docker (pull_request) Failing after 56s
test / image-input-builds (pull_request) Successful in 57s
test / unit (pull_request) Successful in 1m3s
test / coverage (pull_request) Has been skipped
tracker-policy-pr / check-pr (pull_request) Successful in 11s
This commit is contained in:
@@ -89,6 +89,11 @@ def running_agent_containers(
|
|||||||
"docker", "network", "inspect", "--format",
|
"docker", "network", "inspect", "--format",
|
||||||
"{{range .Containers}}{{.Name}}\n{{end}}", network,
|
"{{range .Containers}}{{.Name}}\n{{end}}", network,
|
||||||
])
|
])
|
||||||
|
if proc.returncode != 0:
|
||||||
|
detail = proc.stderr.strip() or f"exit {proc.returncode}"
|
||||||
|
raise InfraLaunchError(
|
||||||
|
f"could not enumerate bottles on gateway network {network}: {detail}"
|
||||||
|
)
|
||||||
return [
|
return [
|
||||||
name for name in (line.strip() for line in proc.stdout.splitlines())
|
name for name in (line.strip() for line in proc.stdout.splitlines())
|
||||||
if name and name != gateway_name
|
if name and name != gateway_name
|
||||||
|
|||||||
@@ -262,6 +262,14 @@ class TestDockerAttachPrimitives(unittest.TestCase):
|
|||||||
with self.assertRaises(FileNotFoundError):
|
with self.assertRaises(FileNotFoundError):
|
||||||
docker.running_agent_containers()
|
docker.running_agent_containers()
|
||||||
|
|
||||||
|
def test_running_agent_containers_fails_hard_on_inspect_failure(self) -> None:
|
||||||
|
inspect = _proc(1, stderr="network unavailable")
|
||||||
|
with patch.object(docker, "run_docker", return_value=inspect):
|
||||||
|
with self.assertRaisesRegex(
|
||||||
|
docker.InfraLaunchError, "network unavailable",
|
||||||
|
):
|
||||||
|
docker.running_agent_containers(network="net")
|
||||||
|
|
||||||
def test_push_ca_cp_then_rebuilds_trust_store(self) -> None:
|
def test_push_ca_cp_then_rebuilds_trust_store(self) -> None:
|
||||||
with patch.object(
|
with patch.object(
|
||||||
docker, "run_docker", side_effect=[_proc(), _proc(), _proc()],
|
docker, "run_docker", side_effect=[_proc(), _proc(), _proc()],
|
||||||
|
|||||||
Reference in New Issue
Block a user