-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fix flaky test-watch-file #34420
Conversation
This comment has been minimized.
This comment has been minimized.
95b53f4
to
5feb148
Compare
5feb148
to
d748c81
Compare
Stress test that shows the failures on master: https://ci.nodejs.org/job/node-stress-single-test/122/ Stress test with this PR showing the test passing: https://ci.nodejs.org/job/node-stress-single-test/137 ✅ |
@nodejs/testing |
This comment has been minimized.
This comment has been minimized.
test/pummel/test-watch-file.js
Outdated
@@ -34,8 +34,11 @@ fs.closeSync(fs.openSync(f, 'w')); | |||
let changes = 0; | |||
function watchFile() { | |||
fs.watchFile(f, (curr, prev) => { | |||
// Make sure there is at least one watch event that shows a changed mtime. | |||
if (curr.mtime <= prev.mtime) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my understanding, this would never really be a strictly-less-than relation, and only ever larger or equal, but if we check for equality we might as well also check for less-than?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the most part, yes. It's a coherence check. Super unlikely edge case: It is possible for the time on a host to be adjusted backwards (to correct for it having been set incorrectly in the first place, for example) but that would be highly unusual of course.
Another stress CI with another fixup commit: https://ci.nodejs.org/job/node-stress-single-test/139/ ✅ |
@nodejs/fs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSLGTM
PR-URL: #34420 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com>
35b6aa1
to
b0b52b2
Compare
Landed in b0b52b2 |
PR-URL: #34420 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com>
PR-URL: #34420 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com>
PR-URL: #34420 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com>
PR-URL: #34420 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Example of the failure this will avoid is https://ci.nodejs.org/job/node-test-commit-linux/36156/nodes=alpine-latest-x64/testReport/junit/(root)/test/pummel_test_watch_file/:
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes