-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix racy X11 forwarding test #48045
Fix racy X11 forwarding test #48045
Conversation
{require,assert}.Eventually run the passed in func on a new goroutine for each attempt, so it's not safe to write to a shared variable without any synchronization. Closes #47756
@@ -4749,15 +4749,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)) | |||
display <- strings.TrimSpace(string(output)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a buffer of 1 should be okay, since as soon as this write occurs the entire require.EventuallyWithT
should complete, but would appreciate more 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could make it a non-blocking channel write that just discards the value if there's something in the channel already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that the Eventually
functions can overlap in execution is insane, and I'm now worried if there's other tests where we assume they don't. 😰
Agreed. |
{require,assert}.Eventually run the passed in func on a new goroutine for each attempt, so it's not safe to write to a shared variable without any synchronization. Closes #47756
{require,assert}.Eventually run the passed in func on a new goroutine for each attempt, so it's not safe to write to a shared variable without any synchronization.
Closes #47756