Skip to content

test_build_and_run: dump container logs and Health.Log on healthcheck failure #3147

@adamtheturtle

Description

@adamtheturtle

Problem

tests/mock_vws/test_docker.py::test_build_and_run occasionally fails with:

ValueError: Container vws-mock-target-manager-... is not healthy: unhealthy

When this happens, the only information the test surfaces is the final health_status string. We have no visibility into:

  • The container's stdout/stderr (did Flask crash? did it never start listening?)
  • Docker's State.Health.Log entries (what did each healthcheck probe actually return?)

This makes it impossible to tell whether the failure is a flake (slow startup on a loaded runner exhausting Docker's internal healthcheck retries) or a real bug in the image.

Proposal

When wait_for_health_check exhausts its retries in this test, before raising, dump:

  • container.logs().decode() for each container
  • container.attrs["State"]["Health"]["Log"] (each probe's exit code + output)

Attach them to the assertion message so CI logs contain enough information to diagnose the failure on the next occurrence.

Context

Seen on https://github.com/VWS-Python/vws-python-mock/actions/runs/25480041288/job/74761924239 (PR #3146). Re-run passed, consistent with flakiness, but we should make the next failure actionable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions