1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

fix: replicaof_reject_on_load flake (#3203)

This commit is contained in:
Kostas Kyrimis 2024-06-25 13:52:17 +03:00 committed by GitHub
parent 4357933775
commit 847e2edc09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1897,17 +1897,23 @@ async def test_replicaof_reject_on_load(df_local_factory, df_seeder_factory):
replica = df_local_factory.create(dbfilename=f"dump_{tmp_file_name}")
df_local_factory.start_all([master, replica])
seeder = df_seeder_factory.create(port=replica.port, keys=30000)
await seeder.run(target_deviation=0.1)
seeder = SeederV2(key_target=40000)
c_replica = replica.client()
await seeder.run(c_replica, target_deviation=0.1)
dbsize = await c_replica.dbsize()
assert dbsize >= 9000
assert dbsize >= 30000
replica.stop()
replica.start()
c_replica = replica.client()
# Check replica of not alowed while loading snapshot
try:
# If this fails adjust `keys` and the `assert dbsize >= 30000` above.
# Keep in mind that if the assert False is triggered below, it doesn't mean
# that there is a bug because it could be the case that while executing
# INFO PERSISTENCE df is in loading state but when we call REPLICAOF df
# is no longer in loading state and the assertion false is triggered.
assert "loading:1" in (await c_replica.execute_command("INFO PERSISTENCE"))
await c_replica.execute_command(f"REPLICAOF localhost {master.port}")
assert False
except aioredis.BusyLoadingError as e: