diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-06-01 14:22:31 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-06-06 17:49:48 +0900 |
commit | 32f825c648cb5fc829cd32b3392530613c62e983 (patch) | |
tree | d1eab8df0cab0a99f0f78cf70004e6ea89f5b8f0 /spec/support | |
parent | 10acdc30df99ede1356493c14a57b94ed1ae7950 (diff) | |
download | gitlab-ce-32f825c648cb5fc829cd32b3392530613c62e983.tar.gz |
Add tests for each new code
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_examples/ci_trace_shared_examples.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/support/shared_examples/ci_trace_shared_examples.rb b/spec/support/shared_examples/ci_trace_shared_examples.rb index 21c6f3c829f..a3a0b2d0eb5 100644 --- a/spec/support/shared_examples/ci_trace_shared_examples.rb +++ b/spec/support/shared_examples/ci_trace_shared_examples.rb @@ -227,6 +227,31 @@ shared_examples_for 'common trace features' do end end end + + describe '#archive!' do + subject { trace.archive! } + + 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 + 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 multiple archiving' do + build.reload + expect(build.job_artifacts_trace).to be_nil + end + end + end + end end shared_examples_for 'trace with disabled live trace feature' do |