fix(devops): fix flaky test cleanup in TestDevOps_Boot_Good_FreshFlag

Use os.MkdirTemp with explicit cleanup instead of t.TempDir() to avoid
cleanup errors when subdirectories are created during test execution.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-02-01 06:53:15 +00:00
parent 13f7e29894
commit ebc67ed727

View file

@ -615,12 +615,14 @@ func TestDevOps_IsRunning_Bad_DifferentContainerName(t *testing.T) {
}
func TestDevOps_Boot_Good_FreshFlag(t *testing.T) {
tempDir := t.TempDir()
tempDir, err := os.MkdirTemp("", "devops-test-*")
require.NoError(t, err)
t.Cleanup(func() { os.RemoveAll(tempDir) })
t.Setenv("CORE_IMAGES_DIR", tempDir)
// Create fake image
imagePath := filepath.Join(tempDir, ImageName())
err := os.WriteFile(imagePath, []byte("fake"), 0644)
err = os.WriteFile(imagePath, []byte("fake"), 0644)
require.NoError(t, err)
cfg := DefaultConfig()