Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(replication test): check data only after replica finished execution #746

Merged
merged 2 commits into from
Feb 2, 2023

Conversation

adiholden
Copy link
Collaborator

No description provided.

@adiholden adiholden requested a review from dranikpg February 2, 2023 12:28
Signed-off-by: adi_holden <adi@dragonflydb.io>
Comment on lines +73 to +88
async def check_replica_finished_exec(c_replica):
info_stats = await c_replica.execute_command("INFO")
tc1 = info_stats['total_commands_processed']
await asyncio.sleep(0.1)
info_stats = await c_replica.execute_command("INFO")
tc2 = info_stats['total_commands_processed']
return tc1+1 == tc2 # Replica processed only the info command on above sleep.

async def check_all_replicas_finished():
while True:
await asyncio.sleep(1.0)
is_finished_arr = await asyncio.gather(*(asyncio.create_task(check_replica_finished_exec(c))
for c in c_replicas))
if all(is_finished_arr):
break

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to make those global functions, but so far we use them only in one test

@adiholden adiholden merged commit 4b29dec into main Feb 2, 2023
ashotland pushed a commit that referenced this pull request Feb 2, 2023
…ion (#746)

Signed-off-by: adi_holden <adi@dragonflydb.io>
@romange romange deleted the replication_test_fail_fix branch February 18, 2023 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants