Ma77Ball opened a new pull request, #59840:
URL: https://github.com/apache/spark/pull/59840

   ### What changes were proposed in this pull request?
   This PR removes flakiness from the two Content-Security-Policy tests in 
`ui-test/tests/csp-compliance.test.js`. Each test still scans the whole 
repository, but now reads the matched files concurrently via `fs/promises` 
`readFile` gathered with `Promise.all` instead of reading them one at a time 
with `readFileSync`, and both tests declare an explicit 60s per-test timeout 
through a `SCAN_TIMEOUT_MS` constant. What the tests verify is unchanged: the 
`img-src` test still checks whether any CSS uses a `data:image/` URI and, if 
so, asserts `HttpSecurityFilter`'s CSP allows `data:`; the nonce test still 
flags any `<script>` tag without a `src` attribute and without 
`nonce={CspNonce.get}`.
   
   ### Why are the changes needed?
   Both tests glob every `*.css` and `*.scala` file under the repository root 
(the Scala scan reads ~6,400 files) and run under Jest's default 5000ms 
per-test timeout, since `ui-test/package.json` sets none. On a loaded CI runner 
the scan intermittently exceeds 5s and the tests fail with `Exceeded timeout of 
5000 ms for a test`, which is what was observed in CI. Reading the files 
concurrently keeps the wall-clock well under the limit, and the explicit 60s 
timeout leaves ample headroom for I/O contention, so the tests stop failing for 
reasons unrelated to the CSP properties they check.
   
   ### Does this PR introduce _any_ user-facing change?
   No. The change is limited to a test file; no production code or behavior 
changes.
   
   ### How was this patch tested?
   Ran the full `ui-test` Jest suite locally (`TZ=UTC`): 11 suites / 31 tests 
pass. The `csp-compliance.test.js` file passes in ~2.3s, compared with the 5s 
timeout it was hitting on CI.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Co-authored with Claude Opus 4.8
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to