Skip to content

Make integration test expectations robust on clustered / newer-module Redis Enterprise#511

Merged
mgravell merged 2 commits into
redis:masterfrom
kiryazovi-redis:fix/re-integration-test-expectations
Jul 1, 2026
Merged

Make integration test expectations robust on clustered / newer-module Redis Enterprise#511
mgravell merged 2 commits into
redis:masterfrom
kiryazovi-redis:fix/re-integration-test-expectations

Conversation

@kiryazovi-redis

@kiryazovi-redis kiryazovi-redis commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

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 rule tests (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-key TS.CREATERULE / TS.DELETERULE commands hash to the same slot. On a clustered deployment the un-tagged keys landed on different slots, so the server returned CROSSSLOT before the intended "key does not exist" error.
  • Search DropIndex tests (Search/SearchTests.cs): after dropping an index, accept either error wording — older modules return no such index, newer modules return index not found — instead of selecting one via a server-version gate. The assertion now passes on both.
  • JSON DEBUG MEMORY tests (Json/JsonTests.cs): assert the reported size is non-negative rather than exceeding a fixed threshold. JSON.DEBUG MEMORY is implementation-defined and changed across module versions — older builds return a positive byte count, newer builds return 0 for the same document — so a fixed threshold is not portable.
  • Search SpellCheck test (Search/SearchTests.cs): use the index-scoped size assertion (AssertIndexSize) instead of a whole-database DBSIZE check, 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 MEMORY returning 0 on 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-key TS.CREATERULE / TS.DELETERULE land on one slot instead of failing with CROSSSLOT before 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 uses AssertIndexSize instead of whole-database DBSIZE, matching the async test and avoiding flakes when the shared cluster has other keys.

JSON DEBUG MEMORY sync/async tests assert res >= 0 instead of res > 20, because reported size is implementation-defined and newer modules may return 0.

Reviewed by Cursor Bugbot for commit c1d0ab2. Bugbot is set up for automated code reviews on this repo. Configure here.

- 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.
@mgravell mgravell merged commit 48d085b into redis:master Jul 1, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants