Repository navigation
Fix flaky scanType test assuming SCAN page boundaries - #4615
Merged
Merged
Conversation
SCAN COUNT is only a hint: over a 7-key dict a single COUNT 4 call may legitimately return cursor 0, depending on the per-server random hash seed, so asserting the first page is incomplete fails sporadically. Iterate until the cursor reports completion and assert on the collected keys, mirroring the already-fixed unified variant in AllKindOfValuesCommandsTestBase#scanType.
Test Resultsββ206 filesβ Β±β0ββββ206 suitesβ Β±0βββ10m 3s β±οΈ -25s Results for commit 5060767.βΒ± Comparison against base commit 61411d8. This pull request removes 14 and adds 2 tests. Note that renamed tests count towards both.This pull request skips 925 tests.β»οΈ This comment has been updated with latest results. |
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.
What
Fixes a sporadic failure in the legacy
AllKindOfValuesCommandsTest.scanTypeby removing assertions on SCAN page boundaries.Why
The binary section asserted that
SCAN 0 COUNT 4 TYPE stringover 7 keys cannot complete in one page (assertFalse(isCompleteIteration())).COUNTis only a hint: whether one call traverses the whole dict depends on how the keys distribute across hash buckets, which varies with the per-server random SipHash seed β so the test failed sporadically:The unified variant (
commands/unified/AllKindOfValuesCommandsTestBase#scanType) was already fixed with a cursor loop; the legacy copy was left behind.Changes
assertFalse/assertTrueonisCompleteIteration(), page-count sum) with a cursor loop that iterates until completion and asserts on the collected key set, mirroringAllKindOfValuesCommandsTestBase#scanTypeverbatim.Note:
scanIsCompleteIterationalso assertsassertFalse(isCompleteIteration())on a first page, but over 100 keys with default COUNT β a documented, practically safe assumption (see the comment/link in the test) β and is left unchanged.Verified against a local Redis: the class passes in all parameterized variants (162 tests, 0 failures).
Note
Low Risk
Test-only change; no production code or runtime behavior affected.
Overview
Fixes sporadic failures in
AllKindOfValuesCommandsTest.scanTypefor the binaryTYPE stringpath by stopping assumptions about how many SCAN pagesCOUNT 4needs.The test no longer asserts that the first
SCANcall is incomplete, that the second completes, or that page sizes sum to four keys. It now loops the cursor until iteration completes, aggregates keys, and asserts the set equals{a, c, e, g}βmatching the pattern already used in the unifiedAllKindOfValuesCommandsTestBase#scanTypeand the string-key section of the same test.Reviewed by Cursor Bugbot for commit 5060767. Bugbot is set up for automated code reviews on this repo. Configure here.