Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

shisama
Copy link
Contributor

@shisama shisama commented May 7, 2018

To increase test coverage for fs/promises, add tests for
methods chown(), filehandle.chown() and lchown().

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label May 7, 2018
@ChALkeR ChALkeR added experimental Issues and PRs related to experimental features. fs Issues and PRs related to the fs subsystem / file system. labels May 8, 2018
@BridgeAR
Copy link
Member

@BridgeAR BridgeAR added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels May 18, 2018
@@ -96,6 +98,9 @@ function verifyStatObject(stat) {
await chmod(dest, 0o666);
await fchmod(handle, 0o666);

await chown(dest, process.getuid(), process.getgid());
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Trott
Trott previously requested changes May 21, 2018
Copy link
Member

@Trott Trott left a 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...

@Trott
Copy link
Member

Trott commented May 22, 2018

@cjihrig cjihrig dismissed Trott’s stale review May 22, 2018 18:59

because they said we could

@Trott
Copy link
Member

Trott commented May 22, 2018

Rather than skipping on Windows, should we check that we get the right expected error when on Windows?

Trott
Trott previously requested changes May 22, 2018
Copy link
Member

@Trott Trott left a 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   ...

@shisama shisama changed the title test: add tests for fs/promises chown to increase coverage test: add tests for fsPromises.chown to increase coverage May 23, 2018
@shisama
Copy link
Contributor Author

shisama commented May 23, 2018

@Trott
Thank you for your review.

I missed the doc indicates that the fsPromises.lchown is only implemented on macOS.
Doc: https://nodejs.org/api/fs.html#fs_fspromises_lchown_path_uid_gid

I fixed the method is only called on macOS.

@Trott
Copy link
Member

Trott commented May 23, 2018

@jasnell
Copy link
Member

jasnell commented May 23, 2018

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/

@shisama
Copy link
Contributor Author

shisama commented May 24, 2018

@jasnell
I think node-test-commit-linux failure is a flaky failure.
See #20907

Is the failure of node-test-commit-windows-fanned build bot failure?
This is happened on some PullRequest.

@jasnell
Copy link
Member

jasnell commented May 24, 2018

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.

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@BridgeAR
Copy link
Member

@Trott PTAL. I just checked the CI and added a green check mark next to the CI that you started.

@Trott
Copy link
Member

Trott commented May 31, 2018

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).

@Trott
Copy link
Member

Trott commented May 31, 2018

(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.)

@shisama shisama force-pushed the test-fs-promises-chown branch 2 times, most recently from a41e746 to 8041fa3 Compare June 12, 2018 00:59
@shisama
Copy link
Contributor Author

shisama commented Jun 22, 2018

@Trott CI failure is that parallel/test-net-bytes-per-incoming-chunk-overhead is timeout. It is related to #21322 ?

@Trott
Copy link
Member

Trott commented Jun 22, 2018

@Trott CI failure is that parallel/test-net-bytes-per-incoming-chunk-overhead is timeout. It is related to #21322 ?

@shisama Yes, it would seem to be.

CI: https://ci.nodejs.org/job/node-test-pull-request/15560/

@apapirovski
Copy link
Member

@Trott @mhdawson @cjihrig @jasnell @BridgeAR please have another look. In particular @Trott who is currently blocking this PR. Thanks!

@@ -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());
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cjihrig PTAL Thanks.

@Trott Trott dismissed their stale review June 26, 2018 05:15

ci is green now, clearing my objection

@TimothyGu TimothyGu added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 30, 2018
shisama added 4 commits July 29, 2018 20:39
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.
@TimothyGu
Copy link
Member

Rebased.

CI: https://ci.nodejs.org/job/node-test-pull-request/16070/

@TimothyGu TimothyGu self-assigned this Jul 30, 2018
@TimothyGu
Copy link
Member

@TimothyGu
Copy link
Member

Landed in a4ce449.

@TimothyGu TimothyGu closed this Jul 30, 2018
@TimothyGu TimothyGu removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 30, 2018
TimothyGu pushed a commit that referenced this pull request Jul 30, 2018
To increase test coverage for fs/promises, add tests for
methods chown(), filehandle.chown() and lchown().

PR-URL: #20574
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Сковорода Никита Андреевич <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
targos pushed a commit that referenced this pull request Jul 31, 2018
To increase test coverage for fs/promises, add tests for
methods chown(), filehandle.chown() and lchown().

PR-URL: #20574
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Сковорода Никита Андреевич <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
@targos targos mentioned this pull request Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental Issues and PRs related to experimental features. fs Issues and PRs related to the fs subsystem / file system. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants