From fa266790b42671f9b9f55354cf72c7a76498c534 Mon Sep 17 00:00:00 2001 From: alesapin Date: Thu, 17 Dec 2020 14:29:29 +0300 Subject: [PATCH] Better test --- tests/integration/test_testkeeper_back_to_back/test.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_testkeeper_back_to_back/test.py b/tests/integration/test_testkeeper_back_to_back/test.py index e8a3c9942b2..f74d6a4c646 100644 --- a/tests/integration/test_testkeeper_back_to_back/test.py +++ b/tests/integration/test_testkeeper_back_to_back/test.py @@ -442,6 +442,7 @@ def test_end_of_watches_session(started_cluster): zk.close() except: pass + def test_concurrent_watches(started_cluster): fake_zk = get_fake_zk() fake_zk.restart() @@ -483,7 +484,7 @@ def test_concurrent_watches(started_cluster): def call(total): for i in range(total): create_path_and_watch(random.randint(0, 1000)) - time.sleep(0.2) + time.sleep(random.random() % 0.5) try: rand_num = random.choice(existing_path) trigger_watch(rand_num) @@ -504,7 +505,12 @@ def test_concurrent_watches(started_cluster): p.map(call, arguments) p.close() - time.sleep(3) + # waiting for late watches + for i in range(50): + if dumb_watch_triggered_counter == watches_must_be_triggered: + break + + time.sleep(0.1) assert watches_created == watches_must_be_created assert trigger_called >= watches_trigger_must_be_called