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

fix: mitigate doctor test race condition #4741

Merged
merged 1 commit into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 1 addition & 97 deletions tap-snapshots/test/lib/commands/doctor.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ node -v ok current: v1.0.0, recommended: v1.0.0
npm config get registry ok using default registry (https://registry.npmjs.org/)
which git ok /path/to/git
Perms check on cached files not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache (should be owned by current user)
Perms check on local node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules (should be owned by current user)
Perms check on local node_modules ok
Perms check on global node_modules ok
Perms check on local bin folder ok
Perms check on global bin folder ok
Expand Down Expand Up @@ -514,106 +514,10 @@ Object {
],
],
"warn": Array [
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_logs",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/tmp",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_logs/{DATE}-debug-0.log",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e/be",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af/03",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e/be/ccdeeea0a01ebb0e365e566161f7c68ddcbbe04206d8542742d98875f03f",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af/03/5c781820370e585dc2323edbbc80669bf714da5b47d56510c7d0bd7521ee",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/.bin",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testDir",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testLink",
],
Array [
"checkFilesPermission",
"should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testDir/testFile",
],
],
}
`
Expand Down
6 changes: 4 additions & 2 deletions test/lib/commands/doctor.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,10 @@ t.test('incorrect owner', async t => {
...fs,
lstat: (p, cb) => {
const stat = fs.lstatSync(p)
stat.uid += 1
stat.gid += 1
if (p.endsWith('_cacache')) {
stat.uid += 1
stat.gid += 1
}
return cb(null, stat)
},
},
Expand Down