diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-31 00:07:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-31 00:07:58 +0300 |
commit | 0f0a8be306e7e0cd5693f57414de351808c41db9 (patch) | |
tree | d392e35e7b45c88de68cc5d433fac5ff98bb8504 /spec/services/ci | |
parent | 3fe9588b1c1c4fb58f8ba8e9c27244fc2fc1c103 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/ci')
-rw-r--r-- | spec/services/ci/create_pipeline_service_spec.rb | 8 | ||||
-rw-r--r-- | spec/services/ci/register_job_service_spec.rb | 51 |
2 files changed, 55 insertions, 4 deletions
diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 2c63e621074..a2169a015ee 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -773,8 +773,8 @@ describe Ci::CreatePipelineService do it 'correctly creates builds with auto-retry value configured' do expect(pipeline).to be_persisted - expect(rspec_job.retries_max).to eq 2 - expect(rspec_job.retry_when).to eq ['always'] + expect(rspec_job.options_retry_max).to eq 2 + expect(rspec_job.options_retry_when).to eq ['always'] end end @@ -783,8 +783,8 @@ describe Ci::CreatePipelineService do it 'correctly creates builds with auto-retry value configured' do expect(pipeline).to be_persisted - expect(rspec_job.retries_max).to eq 2 - expect(rspec_job.retry_when).to eq ['runner_system_failure'] + expect(rspec_job.options_retry_max).to eq 2 + expect(rspec_job.options_retry_when).to eq ['runner_system_failure'] end end end diff --git a/spec/services/ci/register_job_service_spec.rb b/spec/services/ci/register_job_service_spec.rb index 2f2c525ccc4..04334fb8915 100644 --- a/spec/services/ci/register_job_service_spec.rb +++ b/spec/services/ci/register_job_service_spec.rb @@ -502,6 +502,57 @@ module Ci end end + context 'when build has data integrity problem' do + let!(:pending_job) do + create(:ci_build, :pending, pipeline: pipeline) + end + + before do + pending_job.update_columns(options: "string") + end + + subject { execute(specific_runner, {}) } + + it 'does drop the build and logs both failures' do + expect(Gitlab::Sentry).to receive(:track_acceptable_exception) + .with(anything, a_hash_including(extra: a_hash_including(build_id: pending_job.id))) + .twice + .and_call_original + + expect(subject).to be_nil + + pending_job.reload + expect(pending_job).to be_failed + expect(pending_job).to be_data_integrity_failure + end + end + + context 'when build fails to be run!' do + let!(:pending_job) do + create(:ci_build, :pending, pipeline: pipeline) + end + + before do + expect_any_instance_of(Ci::Build).to receive(:run!) + .and_raise(RuntimeError, 'scheduler error') + end + + subject { execute(specific_runner, {}) } + + it 'does drop the build and logs failure' do + expect(Gitlab::Sentry).to receive(:track_acceptable_exception) + .with(anything, a_hash_including(extra: a_hash_including(build_id: pending_job.id))) + .once + .and_call_original + + expect(subject).to be_nil + + pending_job.reload + expect(pending_job).to be_failed + expect(pending_job).to be_scheduler_failure + end + end + context 'when an exception is raised during a persistent ref creation' do before do allow_any_instance_of(Ci::PersistentRef).to receive(:exist?) { false } |