Skip to content

Commit a9bbb70

Browse files
committed
cluster test doesn't work
1 parent 3f9b18a commit a9bbb70

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/test_asyncio/test_cwe_404.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ async def op(pipe):
185185
@pytest.mark.onlycluster
186186
async def test_cluster(request, redis_addr):
187187

188+
# TODO: This test actually doesn't work. Once the RedisCluster initializes,
189+
# it will re-connect to the nodes as advertised by the cluster, bypassing
190+
# the single DelayProxy we set up.
191+
# to work around this, we really would nedd a port-remapper for the RedisCluster
192+
188193
redis_addr = redis_addr[0], 6372 # use the cluster port
189194
delay = 0.1
190195
dp = DelayProxy(addr=("127.0.0.1", 5381), redis_addr=redis_addr)
@@ -201,11 +206,13 @@ async def op(r):
201206

202207
dp.send_event.clear()
203208
t = asyncio.create_task(op(r))
204-
await dp.send_event.wait()
209+
# await dp.send_event.wait() # won"t work, because DelayProxy is by-passed
205210
await asyncio.sleep(0.01)
206211
t.cancel()
207-
with pytest.raises(asyncio.CancelledError):
212+
try:
208213
await t
214+
except asyncio.CancelledError:
215+
pass
209216

210217
assert await r.get("bar") == b"bar"
211218
assert await r.ping()

0 commit comments

Comments
 (0)