Skip to content

Commit

Permalink
[v16] Fix flaky test TestIntegrations/X11Forwarding (#50886)
Browse files Browse the repository at this point in the history
* Stagger outer eventually loop to ensure the inner eventually loop has time to complete, avoid racing on the display channel.

* Use select case.
  • Loading branch information
Joerger authored Jan 8, 2025
1 parent fd44172 commit 5bc29ab
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4775,12 +4775,15 @@ func testX11Forwarding(t *testing.T, suite *integrationTestSuite) {
assert.Eventually(t, func() bool {
output, err := os.ReadFile(tmpFile.Name())
if err == nil && len(output) != 0 {
display <- strings.TrimSpace(string(output))
select {
case display <- strings.TrimSpace(string(output)):
default:
}
return true
}
return false
}, time.Second, 100*time.Millisecond, "failed to read display")
}, 10*time.Second, time.Second)
}, 10*time.Second, 1*time.Second)

// Make a new connection to the XServer proxy to confirm that forwarding is working.
serverDisplay, err := x11.ParseDisplay(<-display)
Expand Down

0 comments on commit 5bc29ab

Please sign in to comment.