Skip to content

test: reduce flakiness of RegisterRelationshipCountersInParallelTest#2820

Merged
miparnisari merged 2 commits intomainfrom
reduce-memdb-test-flakes
Feb 26, 2026
Merged

test: reduce flakiness of RegisterRelationshipCountersInParallelTest#2820
miparnisari merged 2 commits intomainfrom
reduce-memdb-test-flakes

Conversation

@tstirrat15
Copy link
Contributor

Description

See https://github.com/authzed/spicedb/actions/runs/21007920564/job/60396619281?pr=2818. We were getting test flakes from write failures that were the result of too much load on the memdb instance. For this reason, we're allowing the set of Memdb tests to run in parallel with other tests, but the test itself will not be parallelized to ensure that we aren't hammering the instance.

Changes

  • Turn off parallelism for memdb tests

Testing

Review.

@tstirrat15 tstirrat15 requested a review from a team as a code owner January 14, 2026 20:35
@github-actions github-actions bot added area/datastore Affects the storage system area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Jan 14, 2026
@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.45%. Comparing base (b7f9dd7) to head (4e871ac).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2820      +/-   ##
==========================================
+ Coverage   74.42%   74.45%   +0.03%     
==========================================
  Files         487      487              
  Lines       60218    60218              
==========================================
+ Hits        44814    44827      +13     
+ Misses      12254    12241      -13     
  Partials     3150     3150              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tstirrat15
Copy link
Contributor Author

Hmm... The memdb tests are already spinning up a separate memdb instance per test, so it's not likely resource contention within a single database.

@tstirrat15 tstirrat15 marked this pull request as draft January 14, 2026 20:39
func TestMemdbDatastore(t *testing.T) {
t.Parallel()
test.All(t, memDBTest{}, true)
// NOTE: The individual tests are not parallelized because enough write traffic will cause
Copy link
Contributor

@miparnisari miparnisari Jan 23, 2026

Choose a reason for hiding this comment

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

i don't understand how this fixes things. Each individual test is creating its own memdb instance. For example:

func RegisterRelationshipCountersInParallelTest(t *testing.T, tester DatastoreTester) {
	rawDS, err := tester.New(0, veryLargeGCInterval, veryLargeGCWindow, 1)

could it be that the default number of retries is 10 and this test is doing 10 parallel writes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh hmmm... yeah I suppose we could reduce it to 9 and see if that helps?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah. but don't harcode to 9, use numAttempts - 1 and maybe rename numAttempts to defaultNumAttempts :P

Copy link
Contributor

Choose a reason for hiding this comment

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

done

@miparnisari miparnisari force-pushed the reduce-memdb-test-flakes branch 2 times, most recently from 9186cf3 to 6a50235 Compare February 26, 2026 13:35
@miparnisari miparnisari changed the title chore: reduce memdb test flakes test: reduce flakiness of RegisterRelationshipCountersInParallelTest Feb 26, 2026
@miparnisari miparnisari force-pushed the reduce-memdb-test-flakes branch from 6a50235 to 4e871ac Compare February 26, 2026 13:36
@miparnisari miparnisari marked this pull request as ready for review February 26, 2026 13:36
@github-actions github-actions bot removed the area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) label Feb 26, 2026
Copy link
Contributor Author

@tstirrat15 tstirrat15 left a comment

Choose a reason for hiding this comment

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

LGTM but I can't approve it because I opened it

@miparnisari miparnisari enabled auto-merge (squash) February 26, 2026 14:33
@miparnisari miparnisari merged commit 80b3228 into main Feb 26, 2026
75 of 80 checks passed
@miparnisari miparnisari deleted the reduce-memdb-test-flakes branch February 26, 2026 14:34
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area/datastore Affects the storage system Skip-Changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants