Skip to content

Conversation

@Trott
Copy link
Member

Refactor test to be skipped in situations where it is expected to fail.
Move from disabled directory to parallel.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test process

@TrottTrott added process Issues and PRs related to the process subsystem. test Issues and PRs related to the tests. labels Apr 13, 2017
@Trott
Copy link
MemberAuthor

Will be interested to see how this goes on CI....

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

@Trott
Copy link
MemberAuthor

Fixed up a bit. Once again, CI: https://ci.nodejs.org/job/node-test-pull-request/7385/

@TrottTrott changed the title test: enable setuid/setgit testtest: enable setuid/setgid testApr 13, 2017
@Trott
Copy link
MemberAuthor

Fixed it up so it isn't skipped anymore.

Would be nice if there was a way to specify tests that need superuser, but I guess we shouldn't expect devs to have local superuser necessarily. (Would be nice for CI, though!)

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

@Trott
Copy link
MemberAuthor

Fixed up more to be forgiving if nobody is not a valid group id.

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

@Trott
Copy link
MemberAuthor

SmartOS is letting me know that different OS's can have somewhat different error messages. Made the check a little more lenient.

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

Copy link
Contributor

@cjihrigcjihrig left a comment

Choose a reason for hiding this comment

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

LGTM once the CI is straightened out.

Refactor test for situations where it was expected to fail. Move from disabled directory to parallel.
@Trott
Copy link
MemberAuthor

@Trott
Copy link
MemberAuthor

Single ARM failure is infrastructure-related. (That instance that failed doesn't even run this test.) CI is effectively green.


assert.throws(
()=>{process.setgid('nobody');},
/^Error:(EPERM,.+|setgidgroupiddoesnotexist)$/
Copy link
Contributor

Choose a reason for hiding this comment

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

I am actually getting Error: EPERM, Operation not permitted for both the cases. Also, the capture group doesn't look correct to me.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I am actually getting Error: EPERM, Operation not permitted for both the cases.

@thefourtheye Error message depends on your operating system. SmartOS gives Error: EPERM, Not owner here.

The regexp allows any error that starts with Error: EPERM, and also allows Error: setgid group id does not exist for the situation where nobody is not included on the operating system (which happens on ubuntu1404-64 in FIPS mode on our CI).

TL;DR: Test passes if you have group nobody and get EPERM back along with some text from the OS, and it will also pass if group nobody doesn't exist at all.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Also, the capture group doesn't look correct to me.

@thefourtheye There's room for improvement. For one thing, it could be a non-capturing group. But the regexp seems to work to me. What situation are you concerned about?

> /^Error: (EPERM, .+|setgid group id does not exist)$/.test('Error: setgid group id does not exist')true > /^Error: (EPERM, .+|setgid group id does not exist)$/.test('Error: setgid group id does not exist adding some text so it will be false')false > /^Error: (EPERM, .+|setgid group id does not exist)$/.test('Error: EPERM, setgid group id does not exist adding some text so it will be false except now it as EPERM at the start so it should be true again')true > 

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I thought EPERM is always going to be there. As "setgid group id does not exist" is present in all the cases, can we make EPERM, optional and check for the presence of "setgid group id does not exist"?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The only thing that's there in all cases is Error: .

> /^Error: (EPERM, .+|setgid group id does not exist)$/.test('Error: EPERM, arbitrary text.')true >

The regexp can be thought of as: String must start with Error: and then there are two options that will match after that. One is EPERM, followed by one or more characters of anything. The other is the string setgid group id does not exist precisely.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh okay.

Trott added a commit to Trott/io.js that referenced this pull request Apr 16, 2017
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: nodejs#12403 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
@Trott
Copy link
MemberAuthor

Landed in 189afc8

@TrottTrott closed this Apr 16, 2017
evanlucas pushed a commit that referenced this pull request Apr 25, 2017
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: #12403 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
@evanlucasevanlucas mentioned this pull request May 1, 2017
evanlucas pushed a commit that referenced this pull request May 1, 2017
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: #12403 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
evanlucas pushed a commit that referenced this pull request May 2, 2017
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: #12403 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
@gibfahn
Copy link
Member

@Trott should this be backported to v6.x?

@Trott
Copy link
MemberAuthor

@Trott should this be backported to v6.x?

@gibfahn I think so.

@gibfahn
Copy link
Member

Didn't backport cleanly, could you raise a PR?

@Trott
Copy link
MemberAuthor

@gibfahn#13060

Trott added a commit to Trott/io.js that referenced this pull request May 20, 2017
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: nodejs#12403 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
gibfahn pushed a commit to gibfahn/node that referenced this pull request Jun 17, 2017
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: nodejs#12403 Backport-PR-URL: nodejs#13060 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
gibfahn pushed a commit that referenced this pull request Jun 20, 2017
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: #12403 Backport-PR-URL: #13060 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 11, 2017
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: #12403 Backport-PR-URL: #13060 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
@Trott
Copy link
MemberAuthor

#13060 landed. Removed backport-requested-v6.x and adding backported-to-v6.x.

@MylesBorinsMylesBorins mentioned this pull request Jul 18, 2017
@TrottTrott deleted the fix-setuid-test branch January 13, 2022 22:45
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

processIssues and PRs related to the process subsystem.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@Trott@gibfahn@jasnell@thefourtheye@santigimeno@cjihrig@hiroppy