Skip to content

Fix flaky scanType test assuming SCAN page boundaries - #4615

Merged
ggivo merged 1 commit into
masterfrom
topic/ggivo/fix-flaky-scantype
Jul 10, 2026
Merged

ggivo merged 1 commit into
masterfrom
topic/ggivo/fix-flaky-scantype

Conversation

@ggivo

@ggivo ggivo commented Jul 10, 2026 •

Copy link
Copy Markdown
Collaborator

What

Fixes a sporadic failure in the legacy AllKindOfValuesCommandsTest.scanType by removing assertions on SCAN page boundaries.

Why

The binary section asserted that SCAN 0 COUNT 4 TYPE string over 7 keys cannot complete in one page (assertFalse(isCompleteIteration())). COUNT is 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:

org.opentest4j.AssertionFailedError: expected: <false> but was: <true>
    at ...AllKindOfValuesCommandsTest.scanType(AllKindOfValuesCommandsTest.java:886)

The unified variant (commands/unified/AllKindOfValuesCommandsTestBase#scanType) was already fixed with a cursor loop; the legacy copy was left behind.

Changes

  • Replaced the two-page assertions (assertFalse/assertTrue on isCompleteIteration(), page-count sum) with a cursor loop that iterates until completion and asserts on the collected key set, mirroring AllKindOfValuesCommandsTestBase#scanType verbatim.

Note: scanIsCompleteIteration also asserts assertFalse(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.scanType for the binary TYPE string path by stopping assumptions about how many SCAN pages COUNT 4 needs.

The test no longer asserts that the first SCAN call 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 unified AllKindOfValuesCommandsTestBase#scanType and 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.

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.
@github-actions

github-actions Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Test Results

β€‡β€ˆ206 files  ± 0β€‚β€ƒβ€‡β€ˆ206 suites  Β±0   10m 3s ⏱️ -25s
7β€ˆ837 tests  -β€Š12  6β€ˆ840 βœ…  -β€Š939β€‚β€ƒβ€‡β€ˆ997 πŸ’€ +927  0 ❌ Β±0 
7β€ˆ845 runsβ€Š  -β€Š24  6β€ˆ840 βœ…  -β€Š959  1β€ˆ005 πŸ’€ +935  0 ❌ Β±0 

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.
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest[1] ‑ testScorer(Scorer, double, double)[1][1]
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest[1] ‑ testScorer(Scorer, double, double)[1][2]
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest[1] ‑ testScorer(Scorer, double, double)[1][3]
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest[1] ‑ testScorer(Scorer, double, double)[1][4]
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest[1] ‑ testScorer(Scorer, double, double)[1][5]
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest[1] ‑ testScorer(Scorer, double, double)[1][6]
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest[1] ‑ testScorer(Scorer, double, double)[1][7]
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest[2] ‑ testScorer(Scorer, double, double)[2][1]
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest[2] ‑ testScorer(Scorer, double, double)[2][2]
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest[2] ‑ testScorer(Scorer, double, double)[2][3]
…
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest ‑ testScorer(Scorer, double, double)[1]
redis.clients.jedis.commands.unified.search.FTHybridCommandsTestBase$SupportedScorersTest ‑ testScorer(Scorer, double, double)[2]
This pull request skips 925 tests.
redis.clients.jedis.commands.commandobjects.CommandObjectsArrayCommandsTest[1] ‑ testArcountMissingKey()[1]
redis.clients.jedis.commands.commandobjects.CommandObjectsArrayCommandsTest[1] ‑ testArcountMissingKeyBinary()[1]
redis.clients.jedis.commands.commandobjects.CommandObjectsArrayCommandsTest[1] ‑ testArdel()[1]
redis.clients.jedis.commands.commandobjects.CommandObjectsArrayCommandsTest[1] ‑ testArdelBinary()[1]
redis.clients.jedis.commands.commandobjects.CommandObjectsArrayCommandsTest[1] ‑ testArdelrange()[1]
redis.clients.jedis.commands.commandobjects.CommandObjectsArrayCommandsTest[1] ‑ testArdelrangeBinary()[1]
redis.clients.jedis.commands.commandobjects.CommandObjectsArrayCommandsTest[1] ‑ testArget()[1]
redis.clients.jedis.commands.commandobjects.CommandObjectsArrayCommandsTest[1] ‑ testArgetBinary()[1]
redis.clients.jedis.commands.commandobjects.CommandObjectsArrayCommandsTest[1] ‑ testArgetrange()[1]
redis.clients.jedis.commands.commandobjects.CommandObjectsArrayCommandsTest[1] ‑ testArgetrangeBinary()[1]
…

♻️ This comment has been updated with latest results.

@ggivo ggivo added maintenance churn Chore: Formatting and comment cleanup (non-functional change) labels Jul 10, 2026
@ggivo
ggivo merged commit 3e34adf into master Jul 10, 2026
17 checks passed
@ggivo
ggivo deleted the topic/ggivo/fix-flaky-scantype branch July 10, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

churn Chore: Formatting and comment cleanup (non-functional change) maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant