Skip to content

fix: fix TestPGCoordinatorDual_Mainline flake #8228

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

Merged
merged 2 commits into from
Jun 28, 2023

Conversation

spikecurtis
Copy link
Contributor

@spikecurtis spikecurtis commented Jun 27, 2023

Fixes the test flake seen here: https://github.com/coder/coder/actions/runs/5376578815/jobs/9753922291?pr=8195

What was happening is that there was a duplicate update pushed, due to races in the test between connecting the clients, agents, and initial heartbeats. We attempt to suppress duplicates by serializing the updates to JSON, and comparing with the last update, but this is sensitive to ordering of the nodes.

Ultimately, the updates are idempotent, so dupes are benign. I'm not going to get super serious about suppressing duplicates by like, sorting into a canonical order or whatever.

Instead, I've just updated the test code to tolerate getting extra updates on the way to whatever final state it's looking for.

Signed-off-by: Spike Curtis <spike@coder.com>
assert.Contains(t, derps, e, "expected DERP %v, got %v", e, derps)
}

func contains(s []int, i int) bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe slices.Contains?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove our slices package maybe if this has all the ones we made.

Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis spikecurtis merged commit c0a01ec into main Jun 28, 2023
@spikecurtis spikecurtis deleted the spike/pgcoordinator-test-flake branch June 28, 2023 07:37
@github-actions github-actions bot locked and limited conversation to collaborators Jun 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants