Skip to content

Commit

Permalink
fix(test): Verify that save has not finished (#3278)
Browse files Browse the repository at this point in the history
fix(test): Verify that save has not finished, otherwise it's an endless loop
  • Loading branch information
chakaz authored Jul 8, 2024
1 parent 775ba34 commit daa7e37
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/dragonfly/replication_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2070,7 +2070,10 @@ async def save_replica():

save_task = asyncio.create_task(save_replica())
while not await is_saving(c_replica): # wait for replica start saving
asyncio.sleep(0.1)
assert "rdb_changes_since_last_success_save:0" not in await c_replica.execute_command(
"info persistence"
), "Weak test case, finished saving too quickly"
await asyncio.sleep(0.1)
await c_replica.execute_command("replicaof no one")
assert await is_saving(c_replica)
await save_task
Expand All @@ -2090,14 +2093,17 @@ async def test_start_replicating_while_save(df_factory):
c_master = master.client()
c_replica = replica.client()

await c_replica.execute_command("DEBUG POPULATE 1000 key 4096 RAND")
await c_replica.execute_command("DEBUG POPULATE 10000 key 4096 RAND")

async def save_replica():
await c_replica.execute_command("save")

save_task = asyncio.create_task(save_replica())
while not await is_saving(c_replica): # wait for server start saving
asyncio.sleep(0.1)
assert "rdb_changes_since_last_success_save:0" not in await c_replica.execute_command(
"info persistence"
), "Weak test case, finished saving too quickly"
await asyncio.sleep(0.1)
await c_replica.execute_command(f"REPLICAOF localhost {master.port}")
assert await is_saving(c_replica)
await save_task
Expand Down

0 comments on commit daa7e37

Please sign in to comment.