-
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,fs: test fs.watch for filename
#13411
Conversation
test/sequential/test-fs-watchfile.js
Outdated
this._handle.close(); | ||
assert.strictEqual(filename, 'foo.txt'); | ||
})); | ||
function WatchTestCase(is, dirName, fileName, field) { |
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.
is
is a very nondescriptive name… I’d probably use the reverse and call it skip
.
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.
shouldSkip
Ok? I like predicates with predicate names.
test/sequential/test-fs-watchfile.js
Outdated
Object.defineProperties(this, { | ||
dirPath: { get: () => `${common.tmpDir}/${this.dirName}` }, | ||
filePath: { get: () => `${this.dirPath}/${this.fileName}` } | ||
}); |
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.
Any reason to not turn this into an ES6 class and use fancy get dirPath() { … }
syntax? :)
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.
silly conservatism.
Will refactor.
test/sequential/test-fs-watchfile.js
Outdated
if (!testCase.is) continue; | ||
fs.mkdirSync(testCase.dirPath); | ||
// long content so it's actually flushed. | ||
const content1 = Date.now() + testCase.fileName.repeat(Math.random() * 1e5); |
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.
Why Math.random()
? I am a bit afraid that this reduces test reproducibility. If you use any random values in a test, please log them to stderr, and if there is an actual reason for Math.random()
please add a comment that describes it – but I’d guess just using .repease(10000)
would to the job just fine?
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.
Remnant from earlier iteration.
Not needed now.
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.
The code changes look good, but it would be good if you could explain why this is being moved to sequential
.
Also, I don’t really get why the setInterval()
was there before… but well, if it passes CI, fine by me. :)
test/sequential/test-fs-watchfile.js
Outdated
} | ||
get dirPath() { return `${common.tmpDir}/${this.dirName}`; } | ||
get filePath() { return `${this.dirPath}/${this.fileName}`; } | ||
} |
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.
Aaah, much better. :)
I don't think this needs to be moved to sequential. When I stress tested the original in sequential, it still failed on AIX. So I don't think it's necessarily load-dependent. I think just sometimes AIX is unreliable with the directory watchers and it's a known limitation of the OS at this time. A comment for the |
Stress: https://ci.nodejs.org/job/node-stress-single-test/nodes=aix61-ppc64/1267/
Move to sequential not necessary. Removed. The backstory is in the refs. tl;dr |
Oh, also a comment explaining why AIX is included in one but left out of the other would be helpful. Can be as simple as: // Node.js on AIX can watch reliably on a file but not (at the current time) on a directory. If you want to be thorough, maybe include a link to one of @gireeshpunathil's comments explaining. |
Thanks for making this all more thorough. I wonder if the |
So apparently this is still
I assumed this would land after #13385
There is a |
|
AIX remove from "watch dir" case |
new output on macOS:
|
test/parallel/test-fs-watchfile.js
Outdated
@@ -93,9 +93,10 @@ const cases = [ | |||
]; | |||
for (const testCase of cases) { | |||
if (testCase.shouldSkip) continue; | |||
console.log(`watching ${testCase[testCase.field]}`) |
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.
if the console.log()
is not part of the test, please omit it.
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.
Will do when investigation finishes.
Another full CI: https://ci.nodejs.org/job/node-test-pull-request/8488/ |
8845436
to
e4d8546
Compare
filename
This should be it: https://ci.nodejs.org/job/node-test-pull-request/8500/ |
New failures on AIX, so testing with no rebase: https://ci.nodejs.org/job/node-test-commit-aix/6394/ |
@refack, I guess the new failures you saw for AIX is in this CI run? if so I believe it is an infra issue, and has resolved by its own in your latest run. Please confirm my understanding, so that there is nothing else to look into from AIX side. Thanks! |
Yes, https://ci.nodejs.org/job/node-test-commit-aix/6384/nodes=aix61-ppc64/tapResults/ |
PR-URL: nodejs#13411 Refs: nodejs#13385 Refs: nodejs#13248 Refs: nodejs#13377 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in c05561e |
Extra post-land sanity of |
Ref: #13385
Ref: #13248
Ref: #13377
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test,fs