diff options
author | Chayim <chayim@users.noreply.github.com> | 2023-03-22 18:04:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 18:04:01 +0200 |
commit | b3c89acd0ffe8303649ad8207bc911b1d6a033eb (patch) | |
tree | 8a2bf6473ab828e9542b2ebe493254831db74d3e /tests/test_asyncio/test_cluster.py | |
parent | 8592cacf9e5069f8f6d392a2bc02aeade87c9d69 (diff) | |
download | redis-py-b3c89acd0ffe8303649ad8207bc911b1d6a033eb.tar.gz |
AsyncIO Race Condition Fix (#2640)v4.4.3
Diffstat (limited to 'tests/test_asyncio/test_cluster.py')
-rw-r--r-- | tests/test_asyncio/test_cluster.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_asyncio/test_cluster.py b/tests/test_asyncio/test_cluster.py index 13e5e26..0857c05 100644 --- a/tests/test_asyncio/test_cluster.py +++ b/tests/test_asyncio/test_cluster.py @@ -340,6 +340,23 @@ class TestRedisClusterObj: rc = RedisCluster.from_url("rediss://localhost:16379") assert rc.connection_kwargs["connection_class"] is SSLConnection + async def test_asynckills(self, r) -> None: + + await r.set("foo", "foo") + await r.set("bar", "bar") + + t = asyncio.create_task(r.get("foo")) + await asyncio.sleep(1) + t.cancel() + try: + await t + except asyncio.CancelledError: + pytest.fail("connection is left open with unread response") + + assert await r.get("bar") == b"bar" + assert await r.ping() + assert await r.get("foo") == b"foo" + async def test_max_connections( self, create_redis: Callable[..., RedisCluster] ) -> None: |