Skip to content

Commit 6bf99b3

Browse files
committed
fix: Retry the file deletion to prevent flakies for issue #938
1 parent a07eac0 commit 6bf99b3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/internal/handle_file_operation_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,13 @@ func TestCompressSelectedFiles(t *testing.T) {
152152
}, DefaultTestTimeout, DefaultTestTick, "Extraction of files failed Required - [%s]+%v",
153153
extractedDir, tt.expectedFilesAfterExtract)
154154

155-
require.NoError(t, os.RemoveAll(extractedDir))
156-
require.NoError(t, os.RemoveAll(zipFile))
155+
// Cleanup with retry for Windows file handle issues
156+
assert.Eventually(t, func() bool {
157+
return os.RemoveAll(extractedDir) == nil
158+
}, DefaultTestTimeout, DefaultTestTick, "Failed to remove extracted directory")
159+
assert.Eventually(t, func() bool {
160+
return os.RemoveAll(zipFile) == nil
161+
}, DefaultTestTimeout, DefaultTestTick, "Failed to remove zip file")
157162
})
158163
}
159164

0 commit comments

Comments
 (0)