Make integration test expectations robust on clustered / newer-module Redis Enterprise#511
Merged
mgravell merged 2 commits intoJul 1, 2026
Conversation
- TimeSeries rules: hash-tag src/dest key pairs so multi-key TS.CREATERULE/
DELETERULE co-locate on one slot, avoiding CROSSSLOT before the intended
key-existence error on a clustered Redis Enterprise DB.
- Search DropIndex: accept both module wordings ("no such index" and
"index not found") instead of gating on an unreliable server version.
- JSON DEBUG MEMORY: assert a positive size rather than a magic >20 byte
threshold that newer modules no longer satisfy.
- Search SpellCheck: use index-scoped size assertion (AssertIndexSize) to
match the async sibling and avoid a whole-DB DBSIZE race on the shared
cluster connection.
…0 on newer builds)
mgravell
approved these changes
Jul 1, 2026
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.
Summary
A few integration tests assumed a single-slot deployment or a specific module version, so they passed on some Redis Enterprise deployments but failed on clustered databases and on newer Search/JSON module builds. This makes those tests robust across server and module versions without weakening what they verify. Validated green on 8.0.16, 8.0.22, and a newer (100.x) build.
What changed
TimeSeries/TestAPI/TestRules.cs): hash-tag the source/destination key pairs (e.g.{rules}RULES_TEST_SRC/{rules}RULES_DEST_*) so the keys passed to the multi-keyTS.CREATERULE/TS.DELETERULEcommands hash to the same slot. On a clustered deployment the un-tagged keys landed on different slots, so the server returnedCROSSSLOTbefore the intended "key does not exist" error.DropIndextests (Search/SearchTests.cs): after dropping an index, accept either error wording — older modules returnno such index, newer modules returnindex not found— instead of selecting one via a server-version gate. The assertion now passes on both.DEBUG MEMORYtests (Json/JsonTests.cs): assert the reported size is non-negative rather than exceeding a fixed threshold.JSON.DEBUG MEMORYis implementation-defined and changed across module versions — older builds return a positive byte count, newer builds return0for the same document — so a fixed threshold is not portable.SpellChecktest (Search/SearchTests.cs): use the index-scoped size assertion (AssertIndexSize) instead of a whole-databaseDBSIZEcheck, so the test no longer races with other tests sharing the same cluster connection. This mirrors how the existing async sibling already asserts.Why
These tests exercised behavior that legitimately differs across deployment topologies (clustered vs. single-slot) and module versions. Pinning them to one topology/version made them flaky or falsely red on newer Redis Enterprise environments. The updated assertions accept both valid behaviors where a server/module behavior changed and remove reliance on brittle version gates, while still verifying the underlying functionality.
Note
JSON.DEBUG MEMORYreturning0on newer JSON modules (verified against a current build) is worth confirming with the module team — the test now tolerates it, but if a positive size is expected that may be a separate module-side item.Note
Low Risk
Test-only assertion and key-naming changes; no production library or runtime behavior is modified.
Overview
Integration tests are updated so they pass on clustered Redis Enterprise and newer Search/JSON module builds without dropping the behaviors they check.
TimeSeries rule tests now use hash tags (
{rules},{align}) on source/destination keys so multi-keyTS.CREATERULE/TS.DELETERULEland on one slot instead of failing withCROSSSLOTbefore the expected TSDB errors.Search drop-index tests no longer pick a single error string via
EndpointsFixture.IsAtLeast; they accept either "no such index" or "index not found". The sync SpellCheck test usesAssertIndexSizeinstead of whole-databaseDBSIZE, matching the async test and avoiding flakes when the shared cluster has other keys.JSON
DEBUG MEMORYsync/async tests assertres >= 0instead ofres > 20, because reported size is implementation-defined and newer modules may return0.Reviewed by Cursor Bugbot for commit c1d0ab2. Bugbot is set up for automated code reviews on this repo. Configure here.