Skip to content

Tests: Don't remove csp.log in the cspClean action of mock.php #4936

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

Merged
merged 1 commit into from
Sep 29, 2021

Conversation

mgol
Copy link
Member

@mgol mgol commented Sep 24, 2021

Summary

For some reason the current setup worked fine with Apache but broke for me when
I migrated to nginx.

@Krinkle was there any reason for this unlink call?

Checklist

Sorry, something went wrong.

For some reason the current setup worked fine with Apache but broke for me when
I migrated to nginx.
@mgol mgol requested review from Krinkle and timmywil September 24, 2021 12:09
mgol pushed a commit to mgol/jquery that referenced this pull request Sep 24, 2021
The spec has recently changed and CSS Custom Properties values are trimmed now.
This change makes jQuery polyfill that new behavior for all browsers.

Ref w3c/csswg-drafts#774
Fixes jquerygh-4926
Closes jquerygh-4930
Closes jquerygh-4936

(partially cherry picked from efadfe9)
@Krinkle
Copy link
Member

Krinkle commented Sep 24, 2021

@mgol I don't remember, but below is what I can think of as being potentially of use:

  • the unlink means the file won't linger as untracked in the working directory after a test run is done.
  • the unlink affects the HTTP status code for requests that are before it is created or after it is emptied (HTTP 404 instead of HTTP 200). Having said that, the JS version never incorporated it, it just returns HTTP 200 always with an empty or non-empty string as response. So presumably our tests are never making the requests too early or too late and not relying on this behaviour?
  • the unlink ensures that each test run starts the same way (the file not existing), instead of it being 404 the first test run, but then starting as empty 200 OK the second time.
  • the unlink ensures that if something went out of control, or if the writing code uses "append" mode to put content, that it will still start empty instead of growing uncontrolled over time. But.. the empty string overwrite ensures that already.

It doesn't make sense to me why the server would have permission to write the file but not delete it. But, if this helps, then I don't think it's worth further investigating. The only thing I'd recommend is to add it to gitignore (unless it is covered already?) to keep the file out of git-status during development since it's not meant to be committed and wouldn't benefit from a dirty signal there.

@mgol
Copy link
Member Author

mgol commented Sep 24, 2021

@Krinkle the file is actually tracked & in the repo as empty. Which makes me think this unlink never really worked as otherwise finishing a test run with it would create a dirty repository state.

Plus, our tests actually do depend on it existing. That’s why migrating to nginx locally broke some tests for me: some requests for csp.log started returning a 404 instead of 200.

I can make the file untracked but then I have to make sure it exists pretty early somehow.

@mgol mgol added Discuss in Meeting Reserved for Issues and PRs that anyone would like to discuss in the weekly meeting. Tests and removed Needs review Discuss in Meeting Reserved for Issues and PRs that anyone would like to discuss in the weekly meeting. labels Sep 29, 2021
@mgol mgol added this to the 3.6.1 milestone Sep 29, 2021
@mgol mgol merged commit 1019074 into jquery:main Sep 29, 2021
@mgol mgol deleted the dont-remove-csp-log branch September 29, 2021 22:08
mgol added a commit that referenced this pull request Sep 29, 2021
For some reason the current setup worked fine with Apache but broke for me when
I migrated to nginx.

Closes gh-4936

(cherry picked from commit 1019074)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants