Redact runtime smoke diagnostics
Dependency Audit / dependency-audit (push) Successful in 1m44s
Deployment Installer / deployment-installer (push) Successful in 7s

This commit is contained in:
2026-08-03 18:36:00 +02:00
parent 313249b8fc
commit 3b3d5b3386
2 changed files with 14 additions and 2 deletions
+5 -2
View File
@@ -56,17 +56,20 @@ class RuntimeImageSmokeTests(unittest.TestCase):
def test_readiness_fails_immediately_when_container_exits(self) -> None:
exited = subprocess.CompletedProcess([], 0, "false\n", "")
logs = subprocess.CompletedProcess([], 0, "fatal startup error\n", "")
logs = subprocess.CompletedProcess(
[], 0, "fatal startup error db-secret\n", ""
)
with patch.object(MODULE, "_run", side_effect=(exited, logs)):
with self.assertRaisesRegex(
MODULE.SmokeError,
"container exited before readiness: fatal startup error",
r"container exited before readiness: fatal startup error \[redacted\]",
):
MODULE._wait_for(
"WebUI",
lambda: self.fail("probe must not run for an exited container"),
timeout=60,
container="web",
redactions=("db-secret",),
)
def test_smoke_supplies_the_packaged_web_upstream_and_schema_contract(self) -> None:
+9
View File
@@ -105,6 +105,7 @@ def _wait_for(
*,
timeout: float,
container: str | None = None,
redactions: Sequence[str] = (),
) -> None:
deadline = time.monotonic() + timeout
last = ""
@@ -122,6 +123,9 @@ def _wait_for(
timeout=30,
)
detail = _tail(logs.stdout + logs.stderr, limit=8000)
for secret in redactions:
if secret:
detail = detail.replace(secret, "[redacted]")
raise SmokeError(
f"{label} container exited before readiness: "
f"{detail or 'no diagnostic output'}"
@@ -330,6 +334,7 @@ def run_smoke(
),
timeout=timeout,
container=names["postgres"],
redactions=redactions,
)
_wait_for(
"Redis",
@@ -340,6 +345,7 @@ def run_smoke(
),
timeout=timeout,
container=names["redis"],
redactions=redactions,
)
record("managed_dependencies_ready", began)
@@ -447,6 +453,7 @@ def run_smoke(
),
timeout=timeout,
container=names["api"],
redactions=redactions,
)
_run(
(
@@ -506,6 +513,7 @@ def run_smoke(
),
timeout=timeout,
container=names["web"],
redactions=redactions,
)
_run(
("docker", "exec", names["web"], "sh", "-c", "test \"$(id -u)\" = 101"),
@@ -568,6 +576,7 @@ def run_smoke(
),
timeout=timeout,
container=names["worker"],
redactions=redactions,
)
_run(("docker", "stop", "--time", "20", names["worker"]), timeout=30)
record("worker_delivery_and_shutdown", began)