-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Issue 1281 warning on no write #7126
Conversation
Thanks for the contribution! Below are some guidelines Cypress uses when doing PR reviews.
PR Review ChecklistIf any of the following requirements can't be met, leave a comment in the review selecting 'Request changes', otherwise 'Approve'. User Experience
Functionality
Maintainability
Quality
Internal
|
ffca899
to
201ce45
Compare
@jennifer-shehane Could I get a review on this? Its a continuation of a PR you were reviewing: #5584 |
d2aa498
to
34e5e6d
Compare
@jennifer-shehane Merged your changes! Thanks for those. Is there anything else you'd like me to do before this is ready to be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you add snapshots, this generates a file of the stdout output of the test you wrote. So, you need to run SNAPSHOT_UPDATE=1 yarn test-e2e 8_read_only
to generate this file for comparison later (I've gone ahead and done this and committed it). The idea is - if something breaks, we'll see the changes in the STDOUT.
Since the test you wrote has randomized characters - this won't work for snapshot testing. Each time you run the test, the generated output will be different. We need the test to have the same output each time the test is run.
c99e6ad
to
78a3f52
Compare
@jennifer-shehane Snapshots updated and ready to go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an issue with the yarn lockfile that was committed. It's resolving to the incorrect has-binary dep. The has-binary dep should not have updated in your committed lockfile.
78a3f52
to
3dae576
Compare
@jennifer-shehane Sorry I didn't catch that when I was reviewing my code. It's resolved now |
packages/server/lib/util/settings.js
Outdated
@@ -126,7 +126,11 @@ module.exports = { | |||
throw err | |||
} | |||
|
|||
// else we cannot read due to folder permissions | |||
if (err.toString().startsWith('Error: EACCES: permission denied')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See how line 119 uses an object to filter the .catch
block. You should be able to do this in a similar fashion:
.catch({ code: 'EACCES' }, () => {
return errors.warning(...)
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done! thanks for the advise
packages/server/package.json
Outdated
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this plz. you may want to turn on the preference to "end files with a newline" in your editor
// the dir needs executable for debugging | ||
// the main test here is that it isn't writable, which would be either 6 or 7 | ||
// See here for more info on these numbers http://permissions-calculator.org/ | ||
chmodr.sync(projectDir, 0o500) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoa, i didn't know this 0o
prefix was a thing, i am only familiar with using octals via the leading 0 (like 0500
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you totally have to do it this way when running in strict mode
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Deprecated_octal
Learn something new about java script everyday
const e2e = require('../support/helpers/e2e') | ||
const chmodr = require('chmodr') | ||
|
||
describe('e2e project dir access', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a nice, robust test. you should rename the file to 8_read_only_fs_spec.ts
to match how other e2e tests are named.
Warning: We failed to record the video. | ||
|
||
This error will not alter the exit code. | ||
|
||
Error: ffmpeg exited with code 1: /tmp/8_read_only_fs/cypress/videos/spec.js.mp4: Permission denied | ||
|
||
[stack trace lines] | ||
|
||
Warning: We failed processing this video. | ||
|
||
This error will not alter the exit code. | ||
|
||
Error: ffmpeg exited with code 1: /tmp/8_read_only_fs/cypress/videos/spec.js.mp4: Permission denied | ||
|
||
[stack trace lines] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would also like to see a screenshot failure here... using a spec that fails should generate a screenshot
This change replaces the error with a warning when cypress is executing tests in a readonly fs.
08cd6a2
to
8f6d58d
Compare
- don't need to run test in a specific browser - can combine SS + video test into one - don't seem to need readonly_fs_spec.js
Nyah... the e2e tests are failing because CI runs as root, and root doesn't get a permission denied error. Let me see how we can work around this. |
85a8019
to
cd368ca
Compare
cd368ca
to
b5e46dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I did some cleanup and made it so that failure to create the videos
directory will also not crash the test. Added a new e2e test stage so we can run the tests as non-root as well.
Note that this PR will not fix errors caused by failure to "scaffold" a new project with a "supportFile". Some work needs to be done to not scaffold supportFolder in And with that, it will need to be made possible for individual scaffolding steps to fail and cause the default values for |
packages/server/test/support/fixtures/projects/read-only-project-root/cypress/plugins/index.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good fix
a76e59a
to
62b4bc9
Compare
62b4bc9
to
2de743b
Compare
@jennifer-shehane it's good to go, just waiting for those dang contributor tests to pass 🙄 It closes #1281 since it will allow the folks in that thread to use Cypress on a read-only FS. I'll open a more specific issue about scaffolding requiring write access once this is closed. (opened #7310) |
Still #1281 See discussion and possible solutions at
npm ERR! https://github.com/cypress-io/cypress/issues/1281
npm ERR!
npm ERR! ----------
npm ERR!
npm ERR! Failed to access /root/.cache/Cypress:
npm ERR!
npm ERR! EACCES: permission denied, mkdir '/root/.cache/Cypress' although tried
|
@yezhengli-Mr9 Please open a new issue if you're encountering an issue with Cypress filling out the template. |
User facing changelog
Cypress no longer requires write access to the projectRoot, it instead will display a warning.
Additional details
How has the user experience changed?
Before
After
PR Tasks
cypress-documentation
?