Skip to content

Wait for the restarted VNC recorder to record the screen - #16880

Open
matrei wants to merge 1 commit into
apache:8.0.xfrom
matrei:fix/flaky-per-test-recording
Open

matrei wants to merge 1 commit into
apache:8.0.xfrom
matrei:fix/flaky-per-test-recording

Conversation

@matrei

@matrei matrei commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Description

PerTestRecordingSpec still fails now and then in CI, on 8.0.x and 8.1.x builds and on pull requests. Since #16405 and #16435, every failure in Develocity is the same: the recording of the second setup test, which loads the upload page, is 2,447–2,951 bytes, below the spec's 5,000-byte floor. That is the size of a recording of black frames only.

WebDriverContainerHolder restarts the VNC recording container before each test, and starting it waits for the recorder to log Connected. The recorder (flvrec.py in testcontainers/vnc-recorder:1.3.0) logs that when its socket connects, before the VNC handshake, and writes black frames until it has received the whole screen. From selenium/standalone-chrome:4.49.0 that is a raw 1920×1080 update of 8.3 MB, which locally arrived 0.4–0.6 s after Connected in the three connects I measured, and takes longer on a busy runner. A test that finished within that time was recorded as a black screen. The 500 ms pauses in the spec only made that less likely.

  • WebDriverContainerHolder#createVncRecordingContainer() gives the recording container a wait strategy that waits until the recorder has logged FrameBufferUpdateRequest twice. In the debug mode that VncRecordingContainer runs it in, the recorder logs it after the handshake, and again each time it has written a screen update to the recording, so the second one means that the recording shows the screen. The startup timeout stays at 15 s.
  • PerTestRecordingSpec no longer pauses, so it checks that a test as short as a page load gets a recording of the screen. Its comments describe the cause.
  • WebDriverContainerHolderSpec checks the wait strategy without Docker, against output captured from the real recorder: the recording container isn't ready after Connected alone, and is once the screen has been recorded.

Recording is off by default. With it on, each test now starts later by the time the recorder takes to receive the screen, and its recording begins with the screen instead of black frames.

Verification

  • Locally, with the pauses removed but without the change to WebDriverContainerHolder, 2 of 3 runs of PerTestRecordingSpec failed like CI: the second recording was 2,524 and 2,619 bytes. With the change, 6 of 6 runs passed. The two setup recordings were 67–69 KB, and the third test's own recording 21–25 KB, where it was about 2 KB of black frames before.
  • The first new test in WebDriverContainerHolderSpec fails without the change to WebDriverContainerHolder.
  • :grails-geb:test passes, 19 tests, and so does :grails-test-examples-geb:integrationTest, 16 tests in 13 specs, which records every test. Its two skipped tests are the Windows-only upload test and a @PendingFeature.
  • ./gradlew clean aggregateViolations --continue passes.

PerTestRecordingSpec still failed now and then in CI: the recording of
its second setup test was 2447 to 2951 bytes, below the 5000 byte floor
that the spec checks. That is the size of a recording of black frames
only.

WebDriverContainerHolder restarts the VNC recording container before
each test, and starting it waited for the recorder to log "Connected".
The recorder logs that when its socket connects, before the VNC
handshake, and writes black frames until it has received the whole
screen, 0.4 to 0.6 s later locally and longer on a busy runner. A test
that finished within that time was recorded as a black screen. The
pauses in the spec only made that less likely.

Starting the recording container now waits until the recorder has
logged "FrameBufferUpdateRequest" twice. In the debug mode that
VncRecordingContainer runs it in, the recorder logs it after the
handshake and again each time it has written a screen update to the
recording, so the second one means that the recording shows the
screen. The startup timeout stays at 15 s.

PerTestRecordingSpec no longer pauses, so it checks that a test as
short as a page load gets a recording of the screen.
@matrei
matrei force-pushed the fix/flaky-per-test-recording branch from 04f32f7 to d44ef1c Compare November 6, 2026 17:10
@testlens-app

testlens-app Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🚨 All tests passed but jobs failed 🚨

Failed Jobs without Test Failures

❌ CI / Hibernate7 Functional Tests (Java 21, indy=false, shard 2)

🏷️ Commit: d44ef1c
▶️ Tests: 105953 executed
⚪️ Checks: 99/99 completed

Rerun Controls

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app/docs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant