From 793595424d1450708284755ef9ad69f38b3ed7f1 Mon Sep 17 00:00:00 2001 From: joerger Date: Tue, 7 Jan 2025 19:52:33 -0800 Subject: [PATCH 1/2] Stagger outer eventually loop to ensure the inner eventually loop has time to complete, avoid racing on the display channel. --- integration/integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/integration_test.go b/integration/integration_test.go index 43f2a358e51b8..e5e845e17cd28 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -4858,7 +4858,7 @@ func testX11Forwarding(t *testing.T, suite *integrationTestSuite) { } return false }, time.Second, 100*time.Millisecond, "failed to read display") - }, 10*time.Second, time.Second) + }, 10*time.Second, 2*time.Second) // Make a new connection to the XServer proxy to confirm that forwarding is working. serverDisplay, err := x11.ParseDisplay(<-display) From e3a100c064003e9beac70b99997706f739749d05 Mon Sep 17 00:00:00 2001 From: joerger Date: Wed, 8 Jan 2025 09:51:05 -0800 Subject: [PATCH 2/2] Use select case. --- integration/integration_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/integration/integration_test.go b/integration/integration_test.go index e5e845e17cd28..0b48c90b46f39 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -4853,12 +4853,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, 2*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)