From 8e694b3dba9e3991ff3fa557233f5b58f6451869 Mon Sep 17 00:00:00 2001 From: Vishal Bala Date: Fri, 30 Oct 2026 12:55:54 +0100 Subject: [PATCH] test(cluster): seed aclear multipage test with one amset The test seeded 600 keys with 600 concurrent aset() calls, each a single-key pipeline. On redis-py 8.x, whose async cluster defaults to 100 connections per node, that raised MaxConnectionsError on slow connects; the 8.1.0 pipeline retry then closed the shared client and tore down other coroutines' connections mid-handshake, failing with "'NoneType' object has no attribute 'writelines'" on Python 3.11. Seed with a single amset() instead. The comment that amset writes nothing on an async cluster was stale: #697 fixed that. --- .../integration/test_redis_cluster_support.py | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/tests/integration/test_redis_cluster_support.py b/tests/integration/test_redis_cluster_support.py index 76c0fcb0..57913b95 100644 --- a/tests/integration/test_redis_cluster_support.py +++ b/tests/integration/test_redis_cluster_support.py @@ -1,7 +1,5 @@ """Tests for Redis Cluster support in RedisVL.""" -import asyncio - import pytest from redis import Redis from redis.asyncio.cluster import RedisCluster as AsyncRedisCluster @@ -408,19 +406,18 @@ async def test_embeddings_cache_aclear_multipage_cluster( pipe.set(f"{noise_prefix}:{i}", "keep") await pipe.execute() - # Seeded with aset, not amset: amset silently writes nothing on an - # async cluster client (it awaits the pipeline returned by the queueing - # call, which drains the queue). That is a separate bug; this test is - # about aclear, so don't let it depend on the broken path. - await asyncio.gather( - *( - cache.aset( - content=f"content-{i}", - model_name="test", - embedding=[0.1, 0.2, 0.3], - ) + # Seed with one amset (one pipeline), not concurrent asets: hundreds of + # pipelines in flight exceed redis-py 8's default of 100 connections + # per node, and its pipeline retry then closes the shared client. + await cache.amset( + [ + { + "content": f"content-{i}", + "model_name": "test", + "embedding": [0.1, 0.2, 0.3], + } for i in range(CLEAR_CACHE_KEYS) - ) + ] ) assert await _acount_keys(cluster_client, f"{name}:*") == CLEAR_CACHE_KEYS