From 8d299bfecff8bc656056658350ad48c829f9ad3f Mon Sep 17 00:00:00 2001 From: Vladislav Shpilevoy Date: Fri, 5 Apr 2024 19:46:42 +0200 Subject: [PATCH] test: fix flaky bucket_ref test One of the cases didn't expect that the rebalancer would move the bucket right from under the test's nose. The patch pauses the rebalancer for the time of this case execution. NO_DOC=test --- test/rebalancer/bucket_ref.result | 18 ++++++++++++++++++ test/rebalancer/bucket_ref.test.lua | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/test/rebalancer/bucket_ref.result b/test/rebalancer/bucket_ref.result index 8d36e825..ecb26d8c 100644 --- a/test/rebalancer/bucket_ref.result +++ b/test/rebalancer/bucket_ref.result @@ -35,6 +35,9 @@ util.push_rs_filters(test_run) _ = test_run:switch('box_1_a') --- ... +vshard.storage.rebalancer_disable() +--- +... vshard.storage.bucket_force_create(1, 100) --- - true @@ -42,6 +45,9 @@ vshard.storage.bucket_force_create(1, 100) _ = test_run:switch('box_2_a') --- ... +vshard.storage.rebalancer_disable() +--- +... vshard.storage.bucket_force_create(101, 100) --- - true @@ -290,6 +296,18 @@ vshard.storage.buckets_info(1) -- function taking the lock is bucket_send, so to test that a -- manual bucket_send is called before rebalancer. -- +vshard.storage.rebalancer_enable() +--- +... +_ = test_run:switch('box_2_a') +--- +... +vshard.storage.rebalancer_enable() +--- +... +_ = test_run:switch('box_1_a') +--- +... keep_lock = true --- ... diff --git a/test/rebalancer/bucket_ref.test.lua b/test/rebalancer/bucket_ref.test.lua index f5796ae6..27a48dfc 100644 --- a/test/rebalancer/bucket_ref.test.lua +++ b/test/rebalancer/bucket_ref.test.lua @@ -15,8 +15,10 @@ util.push_rs_filters(test_run) -- allow bucket transfer or GC during a request execution. -- _ = test_run:switch('box_1_a') +vshard.storage.rebalancer_disable() vshard.storage.bucket_force_create(1, 100) _ = test_run:switch('box_2_a') +vshard.storage.rebalancer_disable() vshard.storage.bucket_force_create(101, 100) _ = test_run:switch('box_1_a') @@ -95,6 +97,10 @@ vshard.storage.buckets_info(1) -- function taking the lock is bucket_send, so to test that a -- manual bucket_send is called before rebalancer. -- +vshard.storage.rebalancer_enable() +_ = test_run:switch('box_2_a') +vshard.storage.rebalancer_enable() +_ = test_run:switch('box_1_a') keep_lock = true send_result = nil -- To make first bucket_send keeping rw_lock it is necessary to