Skip to content

[quality] flaky: TestLeaseRestart_ResumeSurvivesHubRestart TempDir cleanup races contribute-ws writes (ws-state: directory not empty) #6285

Description

@clubanderson

What

test (hub N/3) shards on v5 intermittently fail with:

TempDir RemoveAll cleanup: .../ws-state: directory not empty

in TestLeaseRestart_ResumeSurvivesHubRestart: the contribute-ws hub is still writing lease/state files when t.TempDir() tears the directory down. Seen on runs 33945861132 (v5 branch) and 34037083450 before today's PRs existed, and again on #6214 on 2026-09-08, so it is independent of the change under test.

Ask

Make the test stop the hub (and wait for its writer goroutines to exit) before returning, e.g. a t.Cleanup that calls the hub's shutdown and blocks on its done channel, registered after the TempDir so it runs first. No time.Sleep (TestSleepRatchet is at its baseline). Add a -race -count=3 run of this test to the PR body as evidence.

Related: #6282 (same class of teardown race in pkg/agent).

🤖 Generated with Claude Code

https://claude.ai/code/session_01TmdVsn5zULh5KVpFkYrX59

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

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.quality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions