Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-30 03:09:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-30 03:09:37 +0300
commit0ec841b7f902243b832f11b352f215bd93bc680b (patch)
treeefc80df932176a4d9e99377acf720fcdd5f2bf0a /spec/lib/gitlab/exclusive_lease_helpers_spec.rb
parent82f5f2485b37ea938d11181f3e05ddf35ab1959e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/exclusive_lease_helpers_spec.rb')
-rw-r--r--spec/lib/gitlab/exclusive_lease_helpers_spec.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/lib/gitlab/exclusive_lease_helpers_spec.rb b/spec/lib/gitlab/exclusive_lease_helpers_spec.rb
index 747fe369c78..065468f6b06 100644
--- a/spec/lib/gitlab/exclusive_lease_helpers_spec.rb
+++ b/spec/lib/gitlab/exclusive_lease_helpers_spec.rb
@@ -82,10 +82,22 @@ describe Gitlab::ExclusiveLeaseHelpers, :clean_gitlab_redis_shared_state do
end
context 'when sleep second is specified' do
- let(:options) { { retries: 0, sleep_sec: 0.05.seconds } }
+ let(:options) { { retries: 1, sleep_sec: 0.05.seconds } }
it 'receives the specified argument' do
- expect(class_instance).to receive(:sleep).with(0.05.seconds).once
+ expect(class_instance).to receive(:sleep).with(0.05.seconds).twice
+
+ expect { subject }.to raise_error('Failed to obtain a lock')
+ end
+ end
+
+ context 'when sleep second is specified as a lambda' do
+ let(:options) { { retries: 2, sleep_sec: ->(num) { 0.1 + num } } }
+
+ it 'receives the specified argument' do
+ expect(class_instance).to receive(:sleep).with(1.1.seconds).once
+ expect(class_instance).to receive(:sleep).with(2.1.seconds).once
+ expect(class_instance).to receive(:sleep).with(3.1.seconds).once
expect { subject }.to raise_error('Failed to obtain a lock')
end