diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-06-28 21:51:36 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-06-29 01:24:40 +0300 |
commit | 34dbccb24b38c5a7c52641e7008f3ab53b25c66a (patch) | |
tree | 4b5121120fe3973729e546fd3e25a0a4f6106ea9 /spec/support/shared_examples/uploaders/object_storage_shared_examples.rb | |
parent | e38af20cc6eae4f001fd98b0450f00f496a278d0 (diff) |
Add helper methods to stub Gitlab::ExclusiveLease
Diffstat (limited to 'spec/support/shared_examples/uploaders/object_storage_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/uploaders/object_storage_shared_examples.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/spec/support/shared_examples/uploaders/object_storage_shared_examples.rb b/spec/support/shared_examples/uploaders/object_storage_shared_examples.rb index 19800c6638f..1bd176280c5 100644 --- a/spec/support/shared_examples/uploaders/object_storage_shared_examples.rb +++ b/spec/support/shared_examples/uploaders/object_storage_shared_examples.rb @@ -76,8 +76,10 @@ shared_examples "migrates" do |to_store:, from_store: nil| end context 'when migrate! is occupied by another process' do + include ExclusiveLeaseHelpers + before do - @uuid = Gitlab::ExclusiveLease.new(subject.exclusive_lease_key, timeout: 1.hour.to_i).try_obtain + stub_exclusive_lease_taken(subject.exclusive_lease_key, timeout: 1.hour.to_i) end it 'does not execute migrate!' do @@ -91,10 +93,6 @@ shared_examples "migrates" do |to_store:, from_store: nil| expect { subject.use_file }.to raise_error(ObjectStorage::ExclusiveLeaseTaken) end - - after do - Gitlab::ExclusiveLease.cancel(subject.exclusive_lease_key, @uuid) - end end context 'migration is unsuccessful' do |