Skip to content

Commit 4467ed4

Browse files
sentrivanaclaude
andcommitted
test(redis): Allow extra COMMAND span in cluster pipeline streaming test
Older redis-py versions (e.g. 4.6.0) emit an extra COMMAND span during RedisCluster initialization. Mirror the legacy branch's handling so the streaming assertion tolerates it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d046e8a commit 4467ed4

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

tests/integrations/redis/cluster/test_redis_cluster.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,15 @@ def test_rediscluster_pipeline(
171171
pipeline.execute()
172172
sentry_sdk.flush()
173173

174-
assert len(items) == 2
175-
pipeline_span, parent_span = items[0].payload, items[1].payload
176-
174+
# on initializing a RedisCluster, a COMMAND call may be emitted
175+
payloads = [item.payload for item in items]
176+
parent_span = payloads[-1]
177+
redis_spans = payloads[:-1]
177178
assert parent_span["name"] == "custom parent"
179+
assert len(redis_spans) in (1, 2)
180+
assert len(redis_spans) == 1 or redis_spans[0]["name"] == "COMMAND"
181+
182+
pipeline_span = redis_spans[-1]
178183
assert pipeline_span["name"] == "redis.pipeline.execute"
179184
attrs = pipeline_span["attributes"]
180185
assert attrs["sentry.op"] == "db.redis"

0 commit comments

Comments
 (0)