borinquenkid opened a new pull request, #16031:
URL: https://github.com/apache/grails-core/pull/16031

   ## Summary
   `PerTestRecordingSpec > the recordings of the previous two tests are 
different` is
   flaky (~1% of runs per apache/grails-core#16030), with 0 hard failures — 
same commit,
   different outcome on rerun.
   
   ## Root cause
   `waitForRecordingFiles` polled for candidate recording files by existence + 
name-match
   + count only. Testcontainers' `VncRecordingContainer.saveRecordingToFile()` 
copies the
   video with a plain `Files.copy(...)` and no atomic temp-file+rename, so the 
destination
   file becomes visible to a directory scan the instant the copy *starts* — a
   still-writing (possibly 0-byte) file passes the existence check. Two 
still-partial
   files can register as byte-identical via `Files.mismatch`, intermittently 
failing the
   "recordings are different" assertion.
   
   This builds on James's prior fix in c179aacdc0 ("Address flaky test"), which 
fixed an
   earlier race in *which* files get matched but didn't check that a matched 
file had
   finished being written.
   
   ## Fix
   `waitForRecordingFiles` now tracks each candidate file's size across polls 
and only
   accepts a file once its size is `> 0` **and** unchanged from the prior poll 
— proof the
   copy has actually finished, not just that a file handle exists. Kept the 
existing
   10s timeout / 500ms poll interval. This is a targeted readiness check, not a 
generic
   retry — no `@Retry`, no blanket rerun.
   
   ## Testing
   - Real Testcontainers run (Chrome + vnc-recorder, full recording lifecycle):
     `./gradlew :grails-test-examples-geb:integrationTest --tests 
"org.demo.spock.PerTestRecordingSpec"`
     — BUILD SUCCESSFUL, all 3 iterations passed including the previously-flaky 
assertion.
   - No new unit test added: `waitForRecordingFiles` is a private helper 
embedded in the
     integration spec with no public-API surface to test independently; the 
existing
     integration spec is the only legitimate exercise path per the repo's 
public-API
     testing convention.
   - CodeNarc/Checkstyle: clean (`aggregateStyleViolations`, no violations).
   
   Related: apache/grails-core#16030


-- 
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]

Reply via email to