Skip to content

Commit c7de4e6

Browse files
authored
fix: increase timeout for test_redis_replication_all (#7037)
fix: ioncrease timeout for redis_replication_all_test
1 parent 3ca4db6 commit c7de4e6

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

tests/dragonfly/redis_replication_test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
# Checks that master redis and dragonfly replica are synced by writing a random key to master
1212
# and waiting for it to exist in replica. Foreach db in 0..dbcount-1.
13-
async def await_synced(c_master: aioredis.Redis, c_replica: aioredis.Redis, dbcount=1):
13+
async def await_synced(c_master: aioredis.Redis, c_replica: aioredis.Redis, dbcount=1, timeout=30):
1414
rnd_str = "".join(random.choices(string.ascii_letters, k=10))
1515
key = "sync_key/" + rnd_str
1616
for db in range(dbcount):
1717
await c_master.set(key, "dummy")
1818
logging.debug(f"set {key} MASTER db = {db}")
19-
timeout = 30
20-
while timeout > 0:
19+
remaining = timeout
20+
while remaining > 0:
2121
v = await c_replica.get(key)
2222
logging.debug(f"get {key} from REPLICA db = {db} got {v}")
2323
if v is not None:
@@ -26,13 +26,13 @@ async def await_synced(c_master: aioredis.Redis, c_replica: aioredis.Redis, dbco
2626
logging.debug(f"replication info: {repl_state}")
2727
await asyncio.sleep(1)
2828

29-
timeout -= 1
30-
assert timeout > 0, "Timeout while waiting for replica to sync"
29+
remaining -= 1
30+
assert remaining > 0, "Timeout while waiting for replica to sync"
3131

3232

33-
async def await_synced_all(c_master, c_replicas):
33+
async def await_synced_all(c_master, c_replicas, timeout=30):
3434
for c_replica in c_replicas:
35-
await await_synced(c_master, c_replica)
35+
await await_synced(c_master, c_replica, timeout=timeout)
3636

3737

3838
async def check_data(seeder, replicas, c_replicas):
@@ -173,14 +173,14 @@ async def test_redis_replication_all(
173173
await stream_task
174174

175175
# Check data after full sync
176-
await await_synced_all(c_master, c_replicas)
176+
await await_synced_all(c_master, c_replicas, timeout=60)
177177
await check_data(seeder, replicas, c_replicas)
178178

179179
# Stream more data in stable state
180180
await seeder.run(target_ops=2000)
181181

182182
# Check data after stable state stream
183-
await await_synced_all(c_master, c_replicas)
183+
await await_synced_all(c_master, c_replicas, timeout=60)
184184
await check_data(seeder, replicas, c_replicas)
185185

186186

0 commit comments

Comments
 (0)