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: create home for test-npm-install #28510

Closed
wants to merge 1 commit into from

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Jul 2, 2019

This test currently fails if run as root:

npm ERR! makeDirectory homeless?
npm WARN install-dir No description
npm WARN install-dir No repository field.
npm WARN install-dir No license field.

npm ERR! path /root/node/test/.tmp.0/npm-sandbox/home
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall stat
npm ERR! enoent ENOENT:
no such file or directory,
  stat '/root/node/test/.tmp.0/npm-sandbox/home'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

assert.js:89
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: npm install got error code 254
    at handleExit (/root/node/test/parallel/test-npm-install.js:60:10)
    at /root/node/test/common/index.js:371:15
    at ChildProcess.exithandler (child_process.js:304:5)
    at ChildProcess.emit (events.js:203:13)
    at maybeClose (internal/child_process.js:1028:16)
    at Process.ChildProcess._handle.onexit
      (internal/child_process.js:283:5) {
       generatedMessage: false,
       code: 'ERR_ASSERTION',
       actual: 254,
       expected: 0,
       operator: 'strictEqual'
    }

The home directory will be created as expected by npm in the npmSandbox
when run as non-root, but when run as root this directory has to exist.

This commit creates the home directory to allow the test to pass also
when run as the root user.

Refs: https://github.com/npm/cli/blob/31718e72cb5a03cee7127fc36843e4b55c868d93/lib/utils/correct-mkdir.js#L82-L105

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

This test currently fails if run as root:
npm ERR! makeDirectory homeless?
npm WARN install-dir No description
npm WARN install-dir No repository field.
npm WARN install-dir No license field.

npm ERR! path /root/node/test/.tmp.0/npm-sandbox/home
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall stat
npm ERR! enoent ENOENT:
no such file or directory,
  stat '/root/node/test/.tmp.0/npm-sandbox/home'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

assert.js:89
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: npm install got error code 254
    at handleExit (/root/node/test/parallel/test-npm-install.js:60:10)
    at /root/node/test/common/index.js:371:15
    at ChildProcess.exithandler (child_process.js:304:5)
    at ChildProcess.emit (events.js:203:13)
    at maybeClose (internal/child_process.js:1028:16)
    at Process.ChildProcess._handle.onexit
      (internal/child_process.js:283:5) {
       generatedMessage: false,
       code: 'ERR_ASSERTION',
       actual: 254,
       expected: 0,
       operator: 'strictEqual'
    }

The home directory will be created as expected by npm in the npmSandbox
when run as non-root, but when run as root this directory has to exist.

This commit creates the home directory to allow the test to pass also
when run as the root user.

Refs:https://github.com/npm/cli/blob/
31718e72cb5a03cee7127fc36843e4b55c868d93/
lib/utils/correct-mkdir.js#L82-L105
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Jul 2, 2019
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@danbev danbev added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 3, 2019
@danbev
Copy link
Contributor Author

danbev commented Jul 5, 2019

Landed in cdd3833.

@danbev danbev closed this Jul 5, 2019
@danbev danbev deleted the test-npm-install-as-root branch July 5, 2019 04:02
targos pushed a commit that referenced this pull request Jul 20, 2019
This test currently fails if run as root:
npm ERR! makeDirectory homeless?
npm WARN install-dir No description
npm WARN install-dir No repository field.
npm WARN install-dir No license field.

npm ERR! path /root/node/test/.tmp.0/npm-sandbox/home
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall stat
npm ERR! enoent ENOENT:
no such file or directory,
  stat '/root/node/test/.tmp.0/npm-sandbox/home'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

assert.js:89
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: npm install got error code 254
    at handleExit (/root/node/test/parallel/test-npm-install.js:60:10)
    at /root/node/test/common/index.js:371:15
    at ChildProcess.exithandler (child_process.js:304:5)
    at ChildProcess.emit (events.js:203:13)
    at maybeClose (internal/child_process.js:1028:16)
    at Process.ChildProcess._handle.onexit
      (internal/child_process.js:283:5) {
       generatedMessage: false,
       code: 'ERR_ASSERTION',
       actual: 254,
       expected: 0,
       operator: 'strictEqual'
    }

The home directory will be created as expected by npm in the npmSandbox
when run as non-root, but when run as root this directory has to exist.

This commit creates the home directory to allow the test to pass also
when run as the root user.

Refs:https://github.com/npm/cli/blob/
31718e72cb5a03cee7127fc36843e4b55c868d93/
lib/utils/correct-mkdir.js#L82-L105

PR-URL: #28510
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This was referenced Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants