Skip to content

test(cmd/vedette): wait for run to stop before removing the temp dir (CI flake on #82) - #83

Merged
kiennt048 merged 1 commit into
mainfrom
fix/cmd-tempdir-race
Nov 9, 2026
Merged

kiennt048 merged 1 commit into
mainfrom
fix/cmd-tempdir-race

Conversation

@kiennt048

Copy link
Copy Markdown
Collaborator

What

start and startArgs in cmd/vedette tests cancelled run at cleanup but never waited for it to return. t.TempDir's RemoveAll then raced the shutdown's last writes. CI on #82 (docs only) failed with:

--- FAIL: TestLoopbackHTTPHostAllowlist (4.88s)
    testing.go:1464: TempDir RemoveAll cleanup: unlinkat /tmp/TestLoopbackHTTPHostAllowlist2645352315/001: directory not empty

waitStopped cancels run and then waits for it to return, bounded at 30 s. Its cleanup is registered after t.TempDir, and cleanups run last-in first-out, so it runs before the temp dir is removed.

Local checks

TZ=UTC TMPDIR=/private/tmp go test -race -count=1 ./cmd/vedette/   ok  91.7s (load5 42)
GOOS=linux golangci-lint run ./cmd/vedette/...                      0 issues.

🤖 Generated with Claude Code

start and startArgs cancelled run at cleanup but never waited for it, so t.TempDir's RemoveAll raced the
shutdown's last writes (CI on #82: "TempDir RemoveAll cleanup: unlinkat …/001: directory not empty" in
TestLoopbackHTTPHostAllowlist). waitStopped cancels and waits (30 s bound) in a cleanup registered after the
temp dir, so it runs first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kiennt048
kiennt048 merged commit 7be981d into main Nov 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant