Redact runtime smoke diagnostics
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user