Skip to content

Commit e0dfdd2

Browse files
test,fs: delay unlink in test-regress-nodejsGH-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. Fixes: nodejs#13800
1 parent a84c3be commit e0dfdd2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
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, 300, filename);

0 commit comments

Comments
 (0)