detached 3d41bc5

test(wayland): synchronize exclusion and prefetched frame assertions

Round-trip after a refused exclusion before inspecting server destruction stats. Wait for the prefetched successful frame before injecting failures so request scheduling cannot shift the expected failure count.
commit
3d41bc5a00034b81cc0ddeffaafc23d02beddf14
author
brice · · 2026-10-22 17:03 UTC
parent
0012c9e
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
checks
7/7
refs
maintag: v0.6.1
2 files · +6 -1
M internal/adapters/wayland/extensions_test.go +2 -0
@@ -259,6 +259,8 @@ func TestRefusedExclusionDoesNotPinStoppedSession(t *testing.T) {
259259 target := ports.Target{OutputID: firstOutput(t, s).ID}
260260 _, err := s.BeginExclusion(context.Background(), target)
261261 require.ErrorIs(t, err, ErrExclusionUnavailable)
262+ // BeginExclusion sends destroy but does not wait for the server to read it.
263+ require.NoError(t, s.roundtrip())
262264 require.Equal(t, 1, srv.Stats().DestroyedExclusions, "the failed exclusion object is destroyed")
263265 srv.StopSessions()
264266 _, err = s.Capture(context.Background(), target)
@@ -259,6 +259,8 @@ func TestRefusedExclusionDoesNotPinStoppedSession(t *testing.T) {
259 target := ports.Target{OutputID: firstOutput(t, s).ID}259 target := ports.Target{OutputID: firstOutput(t, s).ID}
260 _, err := s.BeginExclusion(context.Background(), target)260 _, err := s.BeginExclusion(context.Background(), target)
261 require.ErrorIs(t, err, ErrExclusionUnavailable)261 require.ErrorIs(t, err, ErrExclusionUnavailable)
262+ // BeginExclusion sends destroy but does not wait for the server to read it.
263+ require.NoError(t, s.roundtrip())
262 require.Equal(t, 1, srv.Stats().DestroyedExclusions, "the failed exclusion object is destroyed")264 require.Equal(t, 1, srv.Stats().DestroyedExclusions, "the failed exclusion object is destroyed")
263 srv.StopSessions()265 srv.StopSessions()
264 _, err = s.Capture(context.Background(), target)266 _, err = s.Capture(context.Background(), target)
M internal/adapters/wayland/source_test.go +4 -1
@@ -171,8 +171,11 @@ func TestFailedUnknownRepeatsLastFrame(t *testing.T) {
171171 require.NoError(t, err, "recording continues")
172172 require.NotEqual(t, want, fresh.Pixels, "with a new frame")
173173
174+ // Capture prefetched the next frame. Wait for the server to answer it
175+ // before arming failures, so it cannot consume the first injected failure.
176+ require.NoError(t, s.roundtrip())
174177 srv.Fail(maxFrameAttempts, 0)
175- // The capture started after the previous frame was answered before Fail.
178+ // Consume the successful prefetched frame before counting failures.
176179 _, err = s.Capture(context.Background(), target)
177180 require.NoError(t, err)
178181 for range maxFrameAttempts - 1 {
@@ -171,8 +171,11 @@ func TestFailedUnknownRepeatsLastFrame(t *testing.T) {
171 require.NoError(t, err, "recording continues")171 require.NoError(t, err, "recording continues")
172 require.NotEqual(t, want, fresh.Pixels, "with a new frame")172 require.NotEqual(t, want, fresh.Pixels, "with a new frame")
173 173
174+ // Capture prefetched the next frame. Wait for the server to answer it
175+ // before arming failures, so it cannot consume the first injected failure.
176+ require.NoError(t, s.roundtrip())
174 srv.Fail(maxFrameAttempts, 0)177 srv.Fail(maxFrameAttempts, 0)
175- // The capture started after the previous frame was answered before Fail.178+ // Consume the successful prefetched frame before counting failures.
176 _, err = s.Capture(context.Background(), target)179 _, err = s.Capture(context.Background(), target)
177 require.NoError(t, err)180 require.NoError(t, err)
178 for range maxFrameAttempts - 1 {181 for range maxFrameAttempts - 1 {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 9

↑↓ moveenter openesc close