From 186ff31e29d4aebf67ba0b4cbe94615db6dfbd08 Mon Sep 17 00:00:00 2001 From: adiholden Date: Mon, 6 May 2024 18:38:13 +0300 Subject: [PATCH] Fix benchmark (#3017) * fix(benchmark): fix lag check Signed-off-by: adi_holden --------- Signed-off-by: adi_holden --- tools/benchmark/post_run_checks.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/benchmark/post_run_checks.py b/tools/benchmark/post_run_checks.py index fef18e2d7..a7a22ce7d 100644 --- a/tools/benchmark/post_run_checks.py +++ b/tools/benchmark/post_run_checks.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 import redis -import re +import time def main(): @@ -14,9 +14,20 @@ def main(): info = client.info("replication") assert info["role"] == "master" replication_state = info["slave0"] - assert replication_state["lag"] == 0, f"Lag is bad, expected 0, got {replication_state['lag']}" assert replication_state["state"] == "stable_sync" + def is_zero_lag(replication_state): + return replication_state["lag"] == 0 + + # Wait for 10 seconds for lag to be zero + for _ in range(10): + if is_zero_lag(replication_state): + break + time.sleep(1) + replication_state = client.info("replication")["slave0"] + + assert replication_state["lag"] == 0, f"Lag is bad, expected 0, got {replication_state['lag']}" + if __name__ == "__main__": main()