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: fix test-cli-permission tests when cwd contains /tmp #54188

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

sendoru
Copy link
Contributor

@sendoru sendoru commented Aug 3, 2024

Fixes: #54021

`process.permission.has("fs")` checks if the process has permission
for all files under `cwd`. Granting permission for `/tmp` and running
tests with `cwd` containing `/tmp` will make the funtion return
`true`, differing from expected results. Using relative paths ensures
test paths are not `cwd` itself.

Fixes: nodejs#54021
Differing from the other subdirectories of `/` `/tmp` has rwx
permissions for all users. In the case where `firstPath` is `/tmp`,
the last test case will fail, as it expects granting permission to
`firstPath` will be failed. This commit skips the last test case when
`firstPath` is `/tmp`.

Fixes: nodejs#54021
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Aug 3, 2024
Copy link

codecov bot commented Aug 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.09%. Comparing base (d1229ee) to head (615b1b7).
Report is 108 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #54188      +/-   ##
==========================================
- Coverage   87.09%   87.09%   -0.01%     
==========================================
  Files         647      647              
  Lines      181836   181836              
  Branches    34917    34919       +2     
==========================================
- Hits       158376   158372       -4     
- Misses      16743    16744       +1     
- Partials     6717     6720       +3     

see 23 files with indirect coverage changes

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Aug 6, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 6, 2024
@nodejs-github-bot
Copy link
Collaborator

@daeyeon daeyeon added the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 14, 2024
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Aug 14, 2024
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/54188
✔  Done loading data for nodejs/node/pull/54188
----------------------------------- PR info ------------------------------------
Title      test: fix test-cli-permission tests when cwd contains /tmp (#54188)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     sendoru:fix-cli-permission-tests -> nodejs:main
Labels     test, author ready, needs-ci
Commits    2
 - test: use relative paths in test-cli-permission tests
 - test: skip the last test case when `/tmp` is `firstPath`
Committers 1
 - sendoru <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/54188
Fixes: https://github.com/nodejs/node/issues/54021
Reviewed-By: Antoine du Hamel <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/54188
Fixes: https://github.com/nodejs/node/issues/54021
Reviewed-By: Antoine du Hamel <[email protected]>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Sat, 03 Aug 2024 11:56:06 GMT
   ✔  Approvals: 1
   ✔  - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/54188#pullrequestreview-2220368323
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2024-08-06T06:26:26Z: https://ci.nodejs.org/job/node-test-pull-request/60903/
- Querying data for job/node-test-pull-request/60903/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 54188
From https://github.com/nodejs/node
 * branch                  refs/pull/54188/merge -> FETCH_HEAD
✔  Fetched commits as 880c446d9558..615b1b714386
--------------------------------------------------------------------------------
[main 5cee9836ab] test: use relative paths in test-cli-permission tests
 Author: sendoru <[email protected]>
 Date: Sat Aug 3 19:56:52 2024 +0900
 2 files changed, 12 insertions(+), 12 deletions(-)
[main df03bd930f] test: skip the last test case when `/tmp` is `firstPath`
 Author: sendoru <[email protected]>
 Date: Sat Aug 3 20:34:14 2024 +0900
 1 file changed, 3 insertions(+)
   ✔  Patches applied
There are 2 commits in the PR. Attempting autorebase.
Rebasing (2/4)

Executing: git node land --amend --yes
⚠ Found Fixes: #54021, skipping..
--------------------------------- New Message ----------------------------------
test: use relative paths in test-cli-permission tests

process.permission.has("fs") checks if the process has permission
for all files under cwd. Granting permission for /tmp and running
tests with cwd containing /tmp will make the funtion return
true, differing from expected results. Using relative paths ensures
test paths are not cwd itself.

Fixes: #54021
PR-URL: #54188
Reviewed-By: Antoine du Hamel <[email protected]>

[detached HEAD d3cf78067e] test: use relative paths in test-cli-permission tests
Author: sendoru <[email protected]>
Date: Sat Aug 3 19:56:52 2024 +0900
2 files changed, 12 insertions(+), 12 deletions(-)
Rebasing (3/4)
Rebasing (4/4)

Executing: git node land --amend --yes
⚠ Found Fixes: #54021, skipping..
--------------------------------- New Message ----------------------------------
test: skip the last test case when /tmp is firstPath

Differing from the other subdirectories of / /tmp has rwx
permissions for all users. In the case where firstPath is /tmp,
the last test case will fail, as it expects granting permission to
firstPath will be failed. This commit skips the last test case when
firstPath is /tmp.

Fixes: #54021
PR-URL: #54188
Reviewed-By: Antoine du Hamel <[email protected]>

[detached HEAD 178cf79af7] test: skip the last test case when /tmp is firstPath
Author: sendoru <[email protected]>
Date: Sat Aug 3 20:34:14 2024 +0900
1 file changed, 3 insertions(+)

Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/10381021102

@daeyeon daeyeon added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Aug 14, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 14, 2024
@nodejs-github-bot nodejs-github-bot merged commit 02b3095 into nodejs:main Aug 14, 2024
74 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 02b3095

targos pushed a commit that referenced this pull request Aug 14, 2024
`process.permission.has("fs")` checks if the process has permission
for all files under `cwd`. Granting permission for `/tmp` and running
tests with `cwd` containing `/tmp` will make the funtion return
`true`, differing from expected results. Using relative paths ensures
test paths are not `cwd` itself.

Fixes: #54021
PR-URL: #54188
Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit that referenced this pull request Aug 14, 2024
`process.permission.has("fs")` checks if the process has permission
for all files under `cwd`. Granting permission for `/tmp` and running
tests with `cwd` containing `/tmp` will make the funtion return
`true`, differing from expected results. Using relative paths ensures
test paths are not `cwd` itself.

Fixes: #54021
PR-URL: #54188
Reviewed-By: Antoine du Hamel <[email protected]>
EarlyRiser42 pushed a commit to EarlyRiser42/node that referenced this pull request Aug 14, 2024
`process.permission.has("fs")` checks if the process has permission
for all files under `cwd`. Granting permission for `/tmp` and running
tests with `cwd` containing `/tmp` will make the funtion return
`true`, differing from expected results. Using relative paths ensures
test paths are not `cwd` itself.

Fixes: nodejs#54021
PR-URL: nodejs#54188
Reviewed-By: Antoine du Hamel <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Aug 19, 2024
targos pushed a commit that referenced this pull request Sep 21, 2024
`process.permission.has("fs")` checks if the process has permission
for all files under `cwd`. Granting permission for `/tmp` and running
tests with `cwd` containing `/tmp` will make the funtion return
`true`, differing from expected results. Using relative paths ensures
test paths are not `cwd` itself.

Fixes: #54021
PR-URL: #54188
Reviewed-By: Antoine du Hamel <[email protected]>
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. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test-cli-permission tests fail when running with CWD containing /tmp
4 participants