Fix vector set tests to use RESP2 for default clients (#15287)

## Issue

The vector set Python tests intentionally use two clients: 
- the default client (`self.redis`) for the existing RESP2-oriented test
expectations
- `self.redis3` for RESP3-specific coverage.

However, the default client did not explicitly set a protocol, so it
depended on redis-py's default behavior. With newer redis-py versions,
RESP3 is now the default
protocol(https://github.com/redis/redis-py/pull/4052). In particular,
vector set replies such as `VSIM ... WITHSCORES` may be parsed into
map/dict-like structures instead of the RESP2 flat-array shape assumed
by existing tests.

## Changes

Explicitly create the default primary and replica Redis clients with
`protocol=2`.
`self.redis3` is left unchanged and continues to use `protocol=3` for
RESP3-specific test coverage.
This commit is contained in:
Vitah Lin 2026-06-01 13:31:20 +08:00 committed by GitHub
parent 65401042dc
commit 8fcf3dc866
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -96,10 +96,10 @@ class TestCase:
self.error_details = None
self.test_key = f"test:{self.__class__.__name__.lower()}"
# Primary Redis instance
self.redis = redis.Redis(port=primary_port,db=9)
self.redis = redis.Redis(port=primary_port,protocol=2,db=9)
self.redis3 = redis.Redis(port=primary_port,protocol=3,db=9)
# Replica Redis instance
self.replica = redis.Redis(port=replica_port,db=9)
self.replica = redis.Redis(port=replica_port,protocol=2,db=9)
# Replication status
self.replication_setup = False
# Ports