Skip to content

Commit f1c890a

Browse files
jaimecbernardoTrott
authored andcommitted
test,fs: delay unlink in test-regress-GH-4027.js
The sequential/test-regress-GH-4027 test is flaky with an increased system load, failing when the watched file is unlinked before the first state of the watched file is retrieved. After increasing the delay before unlinking and calling setTimeout after watchFile, the flakiness stopped reproducing. PR-URL: #14010 Fixes: #13800 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
1 parent bec3877 commit f1c890a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/sequential/test-regress-GH-4027.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ common.refreshTmpDir();
2929

3030
const filename = path.join(common.tmpDir, 'watched');
3131
fs.writeFileSync(filename, 'quis custodiet ipsos custodes');
32-
setTimeout(fs.unlinkSync, 100, filename);
3332

3433
fs.watchFile(filename, { interval: 50 }, common.mustCall(function(curr, prev) {
3534
assert.strictEqual(prev.nlink, 1);
3635
assert.strictEqual(curr.nlink, 0);
3736
fs.unwatchFile(filename);
3837
}));
38+
39+
setTimeout(fs.unlinkSync, common.platformTimeout(300), filename);

0 commit comments

Comments
 (0)