Make SizeLimit tests deterministic by deduplicating generator output#1098
Draft
dwcullop wants to merge 1 commit into
Draft
Make SizeLimit tests deterministic by deduplicating generator output#1098dwcullop wants to merge 1 commit into
dwcullop wants to merge 1 commit into
Conversation
RandomPersonGenerator emits Person rows drawn from a finite name pool (~21 girls + ~30 boys cross-joined with 24 lastnames squared). Person.Key is Person.Name, so two independent .Take(10) calls can produce overlapping keys with non-trivial probability. When they collide, the second batch's AddOrUpdate produces 9 Adds + 1 Update instead of 10 Adds, breaking the per-message assertions in: - InvokeLimitSizeToWhenOverLimit - AddMoreThanLimitInBatched Both tests now draw 60 candidates up front, dedupe by Key, take the first 20, and split into two non-overlapping batches of 10. Verified: 50/50 consecutive runs of SizeLimitFixture pass with no failures.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SizeLimitFixture.InvokeLimitSizeToWhenOverLimitandSizeLimitFixture.AddMoreThanLimitInBatchedfail intermittently in CI with errors of the form:Both tests build a 10-item batch, then build a second 10-item batch, and assert that the two
AddOrUpdatecalls produced exactly 10 Adds each.RandomPersonGenerator.Take(N)draws randomPersonrows from a finite name pool (~21 first names for girls + ~30 first names for boys, each cross-joined with 24 lastnames squared).Person.KeyisPerson.Name. Two independent.Take(10)calls can return rows that share the same generatedName, so the second batch'sAddOrUpdatesees one of its rows as an existing key and emits 9 Adds + 1 Update instead of 10 Adds + 0 Updates.The probability is small per row, but two
Take(10)calls draw 20 rows into the same key space; birthday-paradox math puts the collision rate at roughly 0.3%. That matches the observed CI failure frequency for these two tests.Fix
Draw a larger candidate pool (60 rows), dedupe by
Key, take the first 20 distinct, and split into two non-overlapping batches of 10. No production code changes.Verification
50 consecutive runs of
SizeLimitFixtureon the branch, zero failures. Targeted command: