Skip to content

Commit 6fee76d

Browse files
committed
fix: add retry with exponential backoff for flaky temp file cleanup check
1 parent 9bccc1e commit 6fee76d

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

test/multipart-incomplete-upload.test.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,19 @@ test('should finish with error on partial upload - saveRequestFiles', async func
102102
const [res] = await once(req, 'response')
103103
t.assert.strictEqual(res.statusCode, 500)
104104

105+
// Retry with exponential backoff until temp files are cleaned up.
106+
// File cleanup is async and may not complete immediately on macOS.
105107
for (const tmpUpload of tmpUploads) {
106-
await t.assert.rejects(fs.access(tmpUpload))
108+
let deleted = false
109+
for (let i = 0; i < 5; i++) {
110+
try {
111+
await fs.access(tmpUpload)
112+
await sleep(50 * Math.pow(2, i))
113+
} catch {
114+
deleted = true
115+
break
116+
}
117+
}
118+
t.assert.ok(deleted, `tmp file ${tmpUpload} should be deleted`)
107119
}
108120
})

0 commit comments

Comments
 (0)