-
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: add tests for fsPromises.chown to increase coverage #20574
Conversation
test/parallel/test-fs-promises.js
Outdated
@@ -96,6 +98,9 @@ function verifyStatObject(stat) { | |||
await chmod(dest, 0o666); | |||
await fchmod(handle, 0o666); | |||
|
|||
await chown(dest, process.getuid(), process.getgid()); |
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.
process.getuid()
and process.getgid()
are not defined on Windows.
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.
@cjihrig
Thank you for your review.
Fixed not to call the process.getuid()
and process.getgid()
on Windows.
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.
These tests seem to fail just about everywhere in CI...
e7b2fdf
to
b4fd185
Compare
Rather than skipping on Windows, should we check that we get the right expected error when on Windows? |
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.
Tests still failing on most platforms:
15:19:05 not ok 584 parallel/test-fs-promises
15:19:05 ---
15:19:05 duration_ms: 0.171
15:19:05 severity: fail
15:19:05 exitcode: 1
15:19:05 stack: |-
15:19:05 (node:4855) ExperimentalWarning: The fs.promises API is experimental
15:19:05 /home/iojs/build/workspace/node-test-commit-linux/nodes/ubuntu1804-docker/test/common/index.js:798
15:19:05 (err) => process.nextTick(() => { throw err; }));
15:19:05 ^
15:19:05
15:19:05 AssertionError [ERR_ASSERTION]: Code: ERR_METHOD_NOT_IMPLEMENTED; The provided arguments length (0) does not match the required ones (1).
15:19:05 at getMessage (internal/errors.js:223:3)
15:19:05 at new NodeError (internal/errors.js:156:13)
15:19:05 at lchown (internal/fs/promises.js:383:11)
15:19:05 at doTest (/home/iojs/build/workspace/node-test-commit-linux/nodes/ubuntu1804-docker/test/parallel/test-fs-promises.js:140:15)
15:19:05 ...
@Trott I missed the doc indicates that the fsPromises.lchown is only implemented on macOS. I fixed the method is only called on macOS. |
Lots of red in the new CI run. Some are flaky failures, some are build bot failures, some are potentially related.... CI seems rather iffy these days... running again: https://ci.nodejs.org/job/node-test-pull-request/15056/ |
yeah, CI in general is in rough shape right now. Let's give it another day or so to see if we can get those issues figured out then give this another run. |
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.
LGTM
@Trott PTAL. I just checked the CI and added a green check mark next to the CI that you started. |
CI: https://ci.nodejs.org/job/node-test-pull-request/15174/ If CI is green or yellow, feel free to clear my objection (although it looks like this needs a rebase and that will probably mean another CI after the rebase). |
(And again, I'd prefer that we don't skip the test on unsupported platforms but instead check that we get the expected error. This will help prevent us from making changes that introduce cryptic unhelpful errors by accident. But this is a suggestion and I'm certainly not going to block this on it. It's also something that can be added in a subsequent PR.) |
511e744
to
0e3a4ca
Compare
a41e746
to
8041fa3
Compare
8041fa3
to
012b2cc
Compare
test/parallel/test-fs-promises.js
Outdated
@@ -133,6 +162,9 @@ function verifyStatObject(stat) { | |||
if (common.canCreateSymLink()) { | |||
const newLink = path.resolve(tmpDir, 'baz3.js'); | |||
await symlink(newPath, newLink); | |||
if (common.isOSX) { | |||
await lchown(newLink, process.getuid(), process.getgid()); |
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 #21498 lands, this could become !common.isWindows
.
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.
Fixed it. Thanks.
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.
@cjihrig PTAL Thanks.
f2d508b
to
345ddc5
Compare
To increase test coverage for fs/promises, add tests for methods chown(), filehandle.chown() and lchown().
Fix not to call `process.getuid()` and `process.getgid()` on Windows.
Add error tests for fsPromises.chown and FileHandle.chown on all platforms.
345ddc5
to
b1183ac
Compare
Landed in a4ce449. |
To increase test coverage for fs/promises, add tests for methods chown(), filehandle.chown() and lchown(). PR-URL: #20574 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
To increase test coverage for fs/promises, add tests for methods chown(), filehandle.chown() and lchown(). PR-URL: #20574 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
To increase test coverage for fs/promises, add tests for
methods chown(), filehandle.chown() and lchown().
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes