Skip to content

Commit f3c0b8c

Browse files
jaimecbernardoMylesBorins
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 346f199 commit f3c0b8c

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
@@ -8,10 +8,11 @@ common.refreshTmpDir();
88

99
const filename = path.join(common.tmpDir, 'watched');
1010
fs.writeFileSync(filename, 'quis custodiet ipsos custodes');
11-
setTimeout(fs.unlinkSync, 100, filename);
1211

1312
fs.watchFile(filename, { interval: 50 }, common.mustCall(function(curr, prev) {
1413
assert.strictEqual(prev.nlink, 1);
1514
assert.strictEqual(curr.nlink, 0);
1615
fs.unwatchFile(filename);
1716
}));
17+
18+
setTimeout(fs.unlinkSync, common.platformTimeout(300), filename);

0 commit comments

Comments
 (0)