Repository navigation
test(cluster): make the pipelining tests use a real cluster client - #794
Merged
Merged
Conversation
Three SearchIndex tests passed a bare redis://localhost:7001 URL, so RedisVL built a plain Redis client and load() raised MovedError as soon as a key hashed to another shard. They now add ?cluster=true and assert the index really holds a RedisCluster client. test_cluster_pipeline_protocol_version_directly read REDIS_CLUSTER_URL with a default port the test cluster never listens on, and skipped on any exception, so it could never fail. It now uses the redis_cluster_url fixture, is parametrised over default/RESP2/RESP3, and has no blanket skip.
vishal-bala
added a commit
that referenced
this pull request
Oct 30, 2026
Co-Authored-By: Claude <noreply@anthropic.com>
vishal-bala
marked this pull request as ready for review
November 6, 2026 17:30
limjoobin
approved these changes
Nov 11, 2026
limjoobin
left a comment
Contributor
There was a problem hiding this comment.
LGTM! This correctly fixes the tests that were using a single-node client or silently skipping, so they now exercise a real RedisCluster client. I encountered the host.docker.internal topology-resolution issue locally, but that is addressed by #796.
|
🚀 PR was released in |
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
The
requires_clustertests intests/integration/test_cluster_pipelining.pynever exercised what they claimed, and CI doesn't run them, so nobody noticed.SearchIndextests passed a bareredis://localhost:7001URL. RedisVL only builds a cluster client when the URL or kwargs say so, so they got a plainRedisclient, andload()raisedMovedErroras soon as a key hashed to another shard.test_cluster_load_with_ttl[None]passed only because its single key happened to land on the node it connected to. They now append?cluster=trueand assert the index holds aRedisClusterclient.test_cluster_pipeline_protocol_version_directlyreadREDIS_CLUSTER_URLwith a default port (7000) the test cluster never listens on, and wrapped everything inexcept Exception: pytest.skip(...), so it always skipped. It now uses theredis_cluster_urlfixture, is parametrised over default/RESP2/RESP3, and fails on a real failure.Test-only change; no library code touched. This is groundwork for a nightly CI job that runs the cluster tests.
Reviewer Brief
Start here:
tests/integration/test_cluster_pipelining.py,_create_cluster_index(). The threeSearchIndextests now build their index through it. It adds?cluster=trueto the URL and asserts that the index really holds aRedisClusterclient, so these tests can no longer slip back onto a single-node client.Where it could fail
tests/integration/test_cluster_pipelining.py:28: theisinstancecheck runs aftercreate(), because the client is only built on first use. If the check ever fails, the index it just created is not dropped. The index name is unique to each test run, so the only cost is a stray index in the test container.Not verified: CI skips every
requires_clustertest, so none of these run there. They were run only against a local six-noderedis:8.4cluster (three primaries, three replicas) on macOS.Beyond CI: All 8 cases in the file pass against that cluster under redis-py 8.1.0 and Python 3.13.9. With the URL reverted to the bare
redis://localhost:7001(and the newisinstancecheck removed), all fourload()tests fail withMovedErrorraised from the plainPipeline. So these tests do catch a single-node client.Reviewed
0e6989f9· Claude Code (claude-opus-5-5) · lenses: correctness, tests, Redis behaviourNote
Low Risk
Test-only changes; no production code. Residual risk is flaky or environment-specific cluster tests if nightly CI differs from the author’s setup.
Overview
Cluster pipelining integration tests now force a real
RedisClusterclient and fail honestly.SearchIndex-backed tests (batch load,batch_search,loadwith TTL) used to take a bare cluster node URL, so RedisVL could build a single-nodeRedisclient and hitMovedErroron shard routing—or pass by luck. They now use acluster_index_urlfixture (?cluster=true) and a shared_create_cluster_index()helper that runscreate()andassert isinstance(index.client, RedisCluster)so the suite actually exercises cluster behavior.test_cluster_pipeline_protocol_version_directlyno longer readsREDIS_CLUSTER_URLwith a wrong default port or wraps everything intry/except+pytest.skip. It uses theredis_cluster_urlfixture, is parametrised over default / RESP2 / RESP3, and assertsget_protocol_versionon a real pipeline, with cleanup infinally.Reviewer brief note: If the
isinstanceassertion fails aftercreate(), the index may be left behind until manual cleanup; names are per-test-run so impact is limited.Not in CI:
requires_clustertests are still skipped on default CI; behavior matches the PR description.Reviewed by Cursor Bugbot for commit 4defc85. Bugbot is set up for automated code reviews on this repo. Configure here.