Skip to content

Commit

Permalink
test: fix flaky bucket_ref test
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Gerold103 committed Apr 10, 2024
1 parent 76f4f3e commit 8d299bf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/rebalancer/bucket_ref.result
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@ util.push_rs_filters(test_run)
_ = test_run:switch('box_1_a')
---
...
vshard.storage.rebalancer_disable()
---
...
vshard.storage.bucket_force_create(1, 100)
---
- true
...
_ = test_run:switch('box_2_a')
---
...
vshard.storage.rebalancer_disable()
---
...
vshard.storage.bucket_force_create(101, 100)
---
- true
Expand Down Expand Up @@ -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
---
...
Expand Down
6 changes: 6 additions & 0 deletions test/rebalancer/bucket_ref.test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8d299bf

Please sign in to comment.