Problem
TestCloudRunSandboxRuntime_Run_BuildsCommand in pkg/runtime has a race condition:
Run() starts a background watchSandbox goroutine that writes to a state file in
t.TempDir(). When the test ends, t.TempDir() cleanup (RemoveAll) races with the
goroutine's writes, causing intermittent "directory not empty" failures on CI.
This has been independently discovered and fixed twice on different branches:
Fix
Add a t.Cleanup() call after Run() returns to cancel the watcher goroutine
before TempDir cleanup fires (t.Cleanup is LIFO, so a cleanup registered after
Run fires before the TempDir RemoveAll).
Files Modified
- pkg/runtime/cloudrun_sandbox_runtime_test.go (test-only change)
Problem
TestCloudRunSandboxRuntime_Run_BuildsCommand in pkg/runtime has a race condition:
Run() starts a background watchSandbox goroutine that writes to a state file in
t.TempDir(). When the test ends, t.TempDir() cleanup (RemoveAll) races with the
goroutine's writes, causing intermittent "directory not empty" failures on CI.
This has been independently discovered and fixed twice on different branches:
Fix
Add a t.Cleanup() call after Run() returns to cancel the watcher goroutine
before TempDir cleanup fires (t.Cleanup is LIFO, so a cleanup registered after
Run fires before the TempDir RemoveAll).
Files Modified