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-06-02 08:09:24 +0300
committerShinya Maeda <shinya@gitlab.com>2018-06-06 11:49:48 +0300
commitf9b821f08dfc8feee2ed8a06c8f21c85c3c9d2ec (patch)
treeb950c212b7797479abe5bf59455ee1c371c75ae9
parent5a1ee0c391a06a323d960eab6ffb33dfcf2edca7 (diff)
Fix specs for exclusive lease
-rw-r--r--app/services/concerns/exclusive_lease_guard.rb2
-rw-r--r--spec/support/shared_examples/ci_trace_shared_examples.rb29
2 files changed, 20 insertions, 11 deletions
diff --git a/app/services/concerns/exclusive_lease_guard.rb b/app/services/concerns/exclusive_lease_guard.rb
index 30be6accc32..f45436370c1 100644
--- a/app/services/concerns/exclusive_lease_guard.rb
+++ b/app/services/concerns/exclusive_lease_guard.rb
@@ -47,6 +47,6 @@ module ExclusiveLeaseGuard
end
def log_error(message, extra_args = {})
- logger.error(message)
+ Rails.logger.error(message)
end
end
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