summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-06-02 14:09:24 +0900
committerShinya Maeda <shinya@gitlab.com>2018-06-06 17:49:48 +0900
commitf9b821f08dfc8feee2ed8a06c8f21c85c3c9d2ec (patch)
treeb950c212b7797479abe5bf59455ee1c371c75ae9 /spec
parent5a1ee0c391a06a323d960eab6ffb33dfcf2edca7 (diff)
downloadgitlab-ce-f9b821f08dfc8feee2ed8a06c8f21c85c3c9d2ec.tar.gz
Fix specs for exclusive lease
Diffstat (limited to 'spec')
-rw-r--r--spec/support/shared_examples/ci_trace_shared_examples.rb29
1 files changed, 19 insertions, 10 deletions
diff --git a/spec/support/shared_examples/ci_trace_shared_examples.rb b/spec/support/shared_examples/ci_trace_shared_examples.rb
index a3a0b2d0eb5..59efce1b5f0 100644
--- a/spec/support/shared_examples/ci_trace_shared_examples.rb
+++ b/spec/support/shared_examples/ci_trace_shared_examples.rb
@@ -234,20 +234,29 @@ shared_examples_for 'common trace features' do
context 'when build status is success' do
let!(:build) { create(:ci_build, :success, :trace_live) }
- it 'archives a trace' do
- subject
-
- expect(build.job_artifacts_trace).to be_exist
+ it 'does not have an archived trace yet' do
+ expect(build.job_artifacts_trace).to be_nil
end
- context 'when anothe process had already been archiving', :clean_gitlab_redis_shared_state do
- before do
- Gitlab::ExclusiveLease.new("trace:archive:#{trace.job.id}", timeout: 1.hour).try_obtain
- end
+ context 'when archives' do
+ it 'has an archived trace' do
+ subject
- it 'prevents multiple archiving' do
build.reload
- expect(build.job_artifacts_trace).to be_nil
+ expect(build.job_artifacts_trace).to be_exist
+ end
+
+ context 'when anothe process had already been archiving', :clean_gitlab_redis_shared_state do
+ before do
+ Gitlab::ExclusiveLease.new("trace:archive:#{trace.job.id}", timeout: 1.hour).try_obtain
+ end
+
+ it 'prevents to archive concurently' do
+ subject
+
+ build.reload
+ expect(build.job_artifacts_trace).to be_nil
+ end
end
end
end