Skip to content

Flaky: TestCheckDockerAvailability_UsesShellwrapResolver times out at its 2s budget under load #1163

Description

@Dumbris

Summary

TestCheckDockerAvailability_UsesShellwrapResolver (internal/upstream) fails at exactly 2.00s when the package runs under load, and passes in ~0.37s in isolation. It sits on a 2-second context.WithTimeout Docker-availability probe while the package's own total runtime is ~1.9–2.0s, so on a busy machine the probe simply runs out of budget.

Sibling of #1150, different mechanism: #1150 was a genuinely wrong assertion; this one is a correct assertion with no headroom.

Evidence

Same worktree, same commit (0909c4d88, main), Docker daemon up throughout:

# full package, machine loaded (parallel agent workflow running)
--- FAIL: TestCheckDockerAvailability_UsesShellwrapResolver (2.00s)
FAIL    github.com/smart-mcp-proxy/mcpproxy-go/internal/upstream   4.080s

# the same test alone, x3
ok      github.com/smart-mcp-proxy/mcpproxy-go/internal/upstream   0.373s
ok      github.com/smart-mcp-proxy/mcpproxy-go/internal/upstream   0.368s
ok      github.com/smart-mcp-proxy/mcpproxy-go/internal/upstream   0.373s

# full package again, machine quieter, x3
ok      github.com/smart-mcp-proxy/mcpproxy-go/internal/upstream   1.981s
ok      github.com/smart-mcp-proxy/mcpproxy-go/internal/upstream   2.010s
ok      github.com/smart-mcp-proxy/mcpproxy-go/internal/upstream   1.914s

The (2.00s) duration is the tell — it is the timeout firing, not an assertion failing.

Package runtime pre-dates today's merges (4e91517da: 2.088s / 1.931s), so this is not a regression from a recent change; it has been marginal for a while and only shows under contention.

Why it is worth fixing

I hit this three times in one session and misattributed it twice — first to my own teardown of some test containers, then to that day's merges. A test that fails only under load, with a duration that looks like a hang, is one a reader will blame on their environment or on whatever they just changed. That is the same tax #1150 was charging.

Suggested fix

Don't just raise the constant — that keeps the same shape with a bigger number. Either:

  • inject the probe deadline so the test controls it rather than sharing a production-shaped 2s budget, or
  • make the availability check's result injectable so the test does not perform a real Docker probe at all (it is asserting which resolver is used, not that Docker answers within 2s).

The second matches what the test's name says it is checking.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/build-ciGitHub Actions, Makefile, build scriptskind/testAdding or improving testspriority/mediumImportant but not blocking a release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions