Skip to content

fix(tests): Use distinct cluster name in buffer fixture to prevent cache pollution#109008

Merged
joshuarli merged 1 commit intomasterfrom
fix/test-pollution-redis-cache-108973
Feb 26, 2026
Merged

fix(tests): Use distinct cluster name in buffer fixture to prevent cache pollution#109008
joshuarli merged 1 commit intomasterfrom
fix/test-pollution-redis-cache-108973

Conversation

@joshuarli
Copy link
Member

@joshuarli joshuarli commented Feb 23, 2026

Summary

  • The buffer fixture in tests/sentry/spans/test_buffer.py was calling use_redis_cluster("default"), which cached a Redis Cluster client under the "default" key in RedisClusterManager._clusters_bytes.
  • After the context manager exited, this cached client persisted and was returned to subsequent tests calling redis_clusters.get_binary("default"), causing them to use the Redis Cluster instead of standalone Redis.
  • Use a distinct cluster name ("span-buffer") with a matching SENTRY_SPAN_BUFFER_CLUSTER setting override to isolate the cache entry.

Fixes #108973

Test plan

  • Verified that single-redis buffer tests run correctly alongside test_delete_count
  • CI should verify the cluster-redis tests still pass (requires Redis Cluster from devservices up --mode backend-ci)

…che pollution

The buffer fixture was calling `use_redis_cluster("default")` which
cached a Redis Cluster client under the "default" key in
`RedisClusterManager._clusters_bytes`. After the context manager exited,
this cached client persisted and was returned to subsequent tests that
called `redis_clusters.get_binary("default")`, causing them to connect
to the Redis Cluster instead of standalone Redis.

Use a distinct cluster name ("span-buffer") with a matching
`SENTRY_SPAN_BUFFER_CLUSTER` setting override to isolate the cache entry.

Fixes #108973
@joshuarli joshuarli merged commit e3b4069 into master Feb 26, 2026
82 checks passed
@joshuarli joshuarli deleted the fix/test-pollution-redis-cache-108973 branch February 26, 2026 00:12
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test pollution: tests/sentry/relay/test_projectconfig_cache.py::test_delete_count

2 participants