Skip to content

test-cli-permission tests fail when running with CWD containing /tmp #54021

Description

@jellelicht

Version

20.15.1

Platform

Linux revint 6.6.40 #1 SMP PREEMPT_DYNAMIC 1 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

# NB, after building node under /tmp:
cd /tmp
./node /path/to/test/parallel/test-cli-permission-deny-fs.js
# or
./node /path/to/test/parallel/test-cli-permission-multiple-allow.js

How often does it reproduce? Is there a required condition?

Be in (any) subdirectory of /tmp (as CWD) when running these tests.

What is the expected behavior? Why is that the expected behavior?

The test succeeding, and not being dependent on CWD for a pass/fail.

What do you see instead?

node:assert:126
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ 'true'
- 'false'
    at Object.<anonymous> (/tmp/guix-build-node-20.15.1.drv-0/node-v20.15.1/test/parallel/test-cli-permission-deny-fs.js:46:10)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: 'true',
  expected: 'false',
  operator: 'strictEqual'
}

and

node:assert:126
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ 'true'
- 'false'
    at Object.<anonymous> (/tmp/guix-build-node-20.15.1.drv-0/node-v20.15.1/test/parallel/test-cli-permission-multiple-allow.js:27:10)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: 'true',
  expected: 'false',
  operator: 'strictEqual'
}

Additional information

There's also some other code in test/parallel/test-cli-permission-deny-fs.js related to CWD which seems to be brittle.
Shouldn't tests fail or succeed regardless of:

  • location of the node binary
  • CWD

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    permissionIssues and PRs related to the Permission Model.testIssues and PRs related to Node.js core tests and test infrastructure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions