Skip to content

fix: CI test failure — TempDir cleanup race in process test#17

Merged
dmitriimaksimovdevelop merged 1 commit into
masterfrom
fix/process-test-cleanup
Apr 2, 2026
Merged

fix: CI test failure — TempDir cleanup race in process test#17
dmitriimaksimovdevelop merged 1 commit into
masterfrom
fix/process-test-cleanup

Conversation

@dmitriimaksimovdevelop
Copy link
Copy Markdown
Owner

Problem

TestProcessTopByCPU_SortRegression fails on Go 1.25+ CI:

TempDir RemoveAll cleanup: unlinkat .../001: directory not empty

A goroutine writes to TempDir after 1ms delay. Go 1.25 made t.TempDir() cleanup stricter — it now fails the test if removal fails. The goroutine could still be writing when cleanup starts.

Fix

done := make(chan struct{})
go func() {
    defer close(done)
    // ...write files...
}()
t.Cleanup(func() { <-done })

Ensures goroutine finishes before TempDir removal. Verified: 5/5 passes locally.

🤖 Generated with Claude Code

TestProcessTopByCPU_SortRegression spawns a goroutine that writes to
TempDir after 1ms. On Go 1.25+ t.TempDir() cleanup is strict and fails
if the directory is not empty. The goroutine could still be writing
when cleanup starts.

Fix: t.Cleanup(func() { <-done }) ensures goroutine finishes before
TempDir removal.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dmitriimaksimovdevelop dmitriimaksimovdevelop merged commit 07525f4 into master Apr 2, 2026
1 check passed
@dmitriimaksimovdevelop dmitriimaksimovdevelop deleted the fix/process-test-cleanup branch April 6, 2026 11:36
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