summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/exclusive_lease_spec.rb
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-06-23 07:36:19 +0200
committerGabriel Mazetto <brodock@gmail.com>2017-06-24 03:40:58 +0200
commit43c3fa4455c5a4d943b0ef9db68b111f52a1177a (patch)
treebf0e39d014fa81d616518da6d8bebd78988d5334 /spec/lib/gitlab/exclusive_lease_spec.rb
parent6b86ce75cf5b716370611f2bccea2b4590d7ce34 (diff)
downloadgitlab-ce-43c3fa4455c5a4d943b0ef9db68b111f52a1177a.tar.gz
Introduce #renew for ExclusiveLeasebackport-renew-exclusive-lease
Diffstat (limited to 'spec/lib/gitlab/exclusive_lease_spec.rb')
-rw-r--r--spec/lib/gitlab/exclusive_lease_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/lib/gitlab/exclusive_lease_spec.rb b/spec/lib/gitlab/exclusive_lease_spec.rb
index a366d68a146..81bbd70ffb8 100644
--- a/spec/lib/gitlab/exclusive_lease_spec.rb
+++ b/spec/lib/gitlab/exclusive_lease_spec.rb
@@ -19,6 +19,19 @@ describe Gitlab::ExclusiveLease, type: :redis do
end
end
+ describe '#renew' do
+ it 'returns true when we have the existing lease' do
+ lease = described_class.new(unique_key, timeout: 3600)
+ expect(lease.try_obtain).to be_present
+ expect(lease.renew).to be_truthy
+ end
+
+ it 'returns false when we dont have a lease' do
+ lease = described_class.new(unique_key, timeout: 3600)
+ expect(lease.renew).to be_falsey
+ end
+ end
+
describe '#exists?' do
it 'returns true for an existing lease' do
lease = described_class.new(unique_key, timeout: 3600)