summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Bernardo <jaime@janeasystems.com>2017-06-30 19:35:52 +0100
committerMyles Borins <mylesborins@google.com>2017-08-15 20:57:35 -0700
commitf3c0b8cd6ea6b653656656648f77d2dd248dc22c (patch)
tree36f54861d55d3bfd56ec44b6d81aa7c63b657e4c
parent346f199e28efef4e6ab9d2c0afb3fe2e7403cd0c (diff)
downloadnode-new-f3c0b8cd6ea6b653656656648f77d2dd248dc22c.tar.gz
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: https://github.com/nodejs/node/pull/14010 Fixes: https://github.com/nodejs/node/issues/13800 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
-rw-r--r--test/sequential/test-regress-GH-4027.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/sequential/test-regress-GH-4027.js b/test/sequential/test-regress-GH-4027.js
index 8d9c6bb1ad..a1332e71c4 100644
--- a/test/sequential/test-regress-GH-4027.js
+++ b/test/sequential/test-regress-GH-4027.js
@@ -8,10 +8,11 @@ common.refreshTmpDir();
const filename = path.join(common.tmpDir, 'watched');
fs.writeFileSync(filename, 'quis custodiet ipsos custodes');
-setTimeout(fs.unlinkSync, 100, filename);
fs.watchFile(filename, { interval: 50 }, common.mustCall(function(curr, prev) {
assert.strictEqual(prev.nlink, 1);
assert.strictEqual(curr.nlink, 0);
fs.unwatchFile(filename);
}));
+
+setTimeout(fs.unlinkSync, common.platformTimeout(300), filename);