Skip to content
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 flaky tests #3294

Merged
merged 5 commits into from
Jul 10, 2024
Merged

Fix flaky tests #3294

merged 5 commits into from
Jul 10, 2024

Conversation

divergentdave
Copy link
Contributor

This fixes some flaky tests I found. Common themes:

  • Some more tests that assume an HPKE config ID is unused needed to be updated to take the initial global HPKE key into account.
  • put_global_hpke_keypair() does not return MutationTargetAlreadyExists, so we can't try to insert a keypair and suppress errors, but we can compare config IDs up front in tests.
  • Some of the checks in task cache tests are racy, and they are more likely to fail under high CPU load. I removed or changed these, so we no longer require that the cache reflect a stale value immediately after changing the database. (since sometimes "immediately" comes too late)

put_global_hpke_keypair() cannot return MutationTargetAlreadyExists.
Rather than change that method, this PR fixes two tests to just avoid
calling the method when it's not needed, and removes matching on the
MutationTargetAlreadyExists error variant.
@divergentdave divergentdave requested a review from a team as a code owner July 10, 2024 16:57
Copy link
Contributor

@inahga inahga left a comment

Choose a reason for hiding this comment

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

Thanks!

// The test context code randomly generates an ID so there's a chance for
// collision.
Ok(_) | Err(datastore::Error::MutationTargetAlreadyExists) => Ok(()),
Err(err) => Err(err),
Copy link
Contributor

Choose a reason for hiding this comment

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

🤦 ah I see, there is no ON CONFLICT DO NOTHING in put_global_hpke_keypair() so if there's a conflict it'll fail with a harder-to-match postgres uniqueness constraint violation error.

@divergentdave divergentdave merged commit 5f94d0c into main Jul 10, 2024
9 checks passed
@divergentdave divergentdave deleted the david/fix-flaky-tests branch July 10, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants