diff options
author | Gabriel Mazetto <gabriel@gitlab.com> | 2018-03-09 16:32:18 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-03-09 16:32:18 +0300 |
commit | 9b5e4ecc55e85304c0eb3e9d3713edbc9bebbeab (patch) | |
tree | 4128cd28482de9646a26e8987d0af6c0a10865e6 /spec/lib/gitlab/exclusive_lease_spec.rb | |
parent | cd7fcfd5779716c302608ce462996809f952ceec (diff) |
Add rake task to cleanup any existing exclusive lease
Diffstat (limited to 'spec/lib/gitlab/exclusive_lease_spec.rb')
-rw-r--r-- | spec/lib/gitlab/exclusive_lease_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/lib/gitlab/exclusive_lease_spec.rb b/spec/lib/gitlab/exclusive_lease_spec.rb index 6193e177668..aed7d8d81ce 100644 --- a/spec/lib/gitlab/exclusive_lease_spec.rb +++ b/spec/lib/gitlab/exclusive_lease_spec.rb @@ -88,4 +88,16 @@ describe Gitlab::ExclusiveLease, :clean_gitlab_redis_shared_state do expect(lease.ttl).to be_nil end end + + describe '.reset_all!' do + it 'removes all existing lease keys from redis' do + uuid = described_class.new(unique_key, timeout: 3600).try_obtain + + expect(described_class.get_uuid(unique_key)).to eq(uuid) + + described_class.reset_all! + + expect(described_class.get_uuid(unique_key)).to be_falsey + end + end end |