FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: add test for uid/gid setting in spawn by Trott · Pull Request #7084 · nodejs/node · GitHub

/ node Public

test: add test for uid/gid setting in spawn - #7084

Closed
Trott wants to merge 4 commits into
nodejs:masterfrom
Trott:uidgid
Closed

test: add test for uid/gid setting in spawn#7084
Trott wants to merge 4 commits into
nodejs:masterfrom
Trott:uidgid

Conversation

Trott commented May 31, 2016

Copy link
Copy Markdown
Member
Checklist
  • tests and code linting passes
  • the commit message follows commit guidelines
Affected core subsystem(s)

test child_process

Description of change

Remove a disabled test in favor of one that expects an error.

This validates (somewhat) that the underlying code is calling the
correct system call for setting UID and GID. Unlike the formerly
disabled test, it does not try to validate that the system UID/GID
setting works.

Remove a disabled test in favor of one that expects an error.

This validates (somewhat) that the underlying code is calling the
correct system call for setting UID and GID. Unlike the formerly
disabled test, it does not try to validate that the system UID/GID
setting works.
Trott added child_process Issues and PRs related to the child_process subsystem. test Issues and PRs related to the tests. labels May 31, 2016

Trott commented May 31, 2016

Copy link
Copy Markdown
Member Author

Windows might have a surprise on this, so running CI immediately: https://ci.nodejs.org/job/node-test-pull-request/2882/


assert.throws(() => {
spawn('echo', ['fhqwhgads'], {gid: 0});
}, /EPERM/, 'Setting GID should throw EPERM for unprivileged users.');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm reasonably sure these are going to fail with ENOTSUP on Windows.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm reasonably sure these are going to fail with ENOTSUP on Windows.

Sure enough: https://ci.nodejs.org/job/node-test-binary-windows/2405/RUN_SUBSET=2,VS_VERSION=vcbt2015,label=win10/tapTestReport/test.tap-23/

Will add a check for common.isWindows and alter the expected error appropriately.

cjihrig commented Jun 2, 2016

Copy link
Copy Markdown
Contributor

There is #7049 about spawning echo on Windows. It kind of applies to this PR. Once that landed, I was going to consolidate all the uses of echo in our tests to a common helper.

Trott commented Jun 2, 2016

Copy link
Copy Markdown
Member Author

Trott commented Jun 3, 2016

Copy link
Copy Markdown
Member Author

CI is green. Anyone feel good enough about this to give a LGTM? @nodejs/testing

Trott commented Jun 3, 2016

Copy link
Copy Markdown
Member Author

@cjihrig OK to leave this one as is and wait for the common helper function? Since the command doesn't actually ever get run--spawn throws in this test--it doesn't actually affect the test results.

cjihrig commented Jun 3, 2016

Copy link
Copy Markdown
Contributor

Yea, LGTM


assert.throws(() => {
spawn('echo', ['fhqwhgads'], {gid: 0});
}, expectedError, 'Setting GID should throw EPERM for unprivileged users.');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe changing the assert message depending if it's windows or not?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd just leave out the message.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

+1 for omitting the message.

Copy link
Copy Markdown
Member

LGTM with one nit you can ignore.

Copy link
Copy Markdown
Member

LGTM with a suggestion.

jasnell commented Jun 3, 2016

Copy link
Copy Markdown
Member

LGTM

Trott added a commit to Trott/io.js that referenced this pull request Jun 3, 2016
Remove a disabled test in favor of one that expects an error.

This validates (somewhat) that the underlying code is calling the
correct system call for setting UID and GID. Unlike the formerly
disabled test, it does not try to validate that the system UID/GID
setting works.

PR-URL: nodejs#7084
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>

Trott commented Jun 3, 2016

Copy link
Copy Markdown
Member Author

Landed in d015169

Trott closed this Jun 3, 2016
evanlucas pushed a commit that referenced this pull request Jun 15, 2016
Remove a disabled test in favor of one that expects an error.

This validates (somewhat) that the underlying code is calling the
correct system call for setting UID and GID. Unlike the formerly
disabled test, it does not try to validate that the system UID/GID
setting works.

PR-URL: #7084
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas mentioned this pull request Jun 16, 2016

Copy link
Copy Markdown
Contributor

@Trott lts?

Trott commented Jul 11, 2016

Copy link
Copy Markdown
Member Author

@thealphanerd If it lands cleanly, yes.

MylesBorins pushed a commit that referenced this pull request Jul 11, 2016
Remove a disabled test in favor of one that expects an error.

This validates (somewhat) that the underlying code is calling the
correct system call for setting UID and GID. Unlike the formerly
disabled test, it does not try to validate that the system UID/GID
setting works.

PR-URL: #7084
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
Remove a disabled test in favor of one that expects an error.

This validates (somewhat) that the underlying code is calling the
correct system call for setting UID and GID. Unlike the formerly
disabled test, it does not try to validate that the system UID/GID
setting works.

PR-URL: #7084
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
Remove a disabled test in favor of one that expects an error.

This validates (somewhat) that the underlying code is calling the
correct system call for setting UID and GID. Unlike the formerly
disabled test, it does not try to validate that the system UID/GID
setting works.

PR-URL: #7084
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins mentioned this pull request Jul 12, 2016
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
Remove a disabled test in favor of one that expects an error.

This validates (somewhat) that the underlying code is calling the
correct system call for setting UID and GID. Unlike the formerly
disabled test, it does not try to validate that the system UID/GID
setting works.

PR-URL: #7084
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
Remove a disabled test in favor of one that expects an error.

This validates (somewhat) that the underlying code is calling the
correct system call for setting UID and GID. Unlike the formerly
disabled test, it does not try to validate that the system UID/GID
setting works.

PR-URL: #7084
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Trott deleted the uidgid branch January 13, 2022 22:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

child_process Issues and PRs related to the child_process subsystem. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL