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:
authorShinya Maeda <shinya@gitlab.com>2018-07-03 07:24:02 +0300
committerShinya Maeda <shinya@gitlab.com>2018-07-03 07:24:02 +0300
commitf930e94363e00e41fceb31f7d8497e5fb530dacd (patch)
treebf7129ec74644026bc7662f525ce77ab38acaae8 /spec/models/ci/build_trace_chunk_spec.rb
parent58a1a0b70c7df0947864d0be933faf0153b537ec (diff)
parent275fbf24b1810e2fbef92b6599d5372855b97b46 (diff)
Merge branch 'master' into build-chunks-on-object-storage
Diffstat (limited to 'spec/models/ci/build_trace_chunk_spec.rb')
-rw-r--r--spec/models/ci/build_trace_chunk_spec.rb26
1 files changed, 12 insertions, 14 deletions
diff --git a/spec/models/ci/build_trace_chunk_spec.rb b/spec/models/ci/build_trace_chunk_spec.rb
index 94a5fe8e5f8..97a5de47b37 100644
--- a/spec/models/ci/build_trace_chunk_spec.rb
+++ b/spec/models/ci/build_trace_chunk_spec.rb
@@ -1,6 +1,8 @@
require 'spec_helper'
describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
+ include ExclusiveLeaseHelpers
+
set(:build) { create(:ci_build, :running) }
let(:chunk_index) { 0 }
let(:data_store) { :redis }
@@ -105,14 +107,12 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
context 'when the other process is appending' do
let(:lease_key) { "trace_write:#{build_trace_chunk.build.id}:chunks:#{build_trace_chunk.chunk_index}" }
- it 'raise an error' do
- begin
- uuid = Gitlab::ExclusiveLease.new(lease_key, timeout: 1.day).try_obtain
+ before do
+ stub_exclusive_lease_taken(lease_key)
+ end
- expect { subject }.to raise_error('Failed to obtain a lock')
- ensure
- Gitlab::ExclusiveLease.cancel(lease_key, uuid)
- end
+ it 'raise an error' do
+ expect { subject }.to raise_error('Failed to obtain a lock')
end
end
@@ -406,14 +406,12 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
context 'when the other process is persisting' do
let(:lease_key) { "trace_write:#{build_trace_chunk.build.id}:chunks:#{build_trace_chunk.chunk_index}" }
- it 'raise an error' do
- begin
- uuid = Gitlab::ExclusiveLease.new(lease_key, timeout: 1.day).try_obtain
+ before do
+ stub_exclusive_lease_taken(lease_key)
+ end
- expect { subject }.to raise_error('Failed to obtain a lock')
- ensure
- Gitlab::ExclusiveLease.cancel(lease_key, uuid)
- end
+ it 'raise an error' do
+ expect { subject }.to raise_error('Failed to obtain a lock')
end
end
end