Commit a4d03f31 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'update-build-doom-method' into 'master'

Drop ci_pending_build when calling `Ci::Build#doom!`

See merge request gitlab-org/gitlab!69796
parents 61a072df 91f19e54
......@@ -1031,9 +1031,10 @@ module Ci
# Consider this object to have a structural integrity problems
def doom!
update_columns(
status: :failed,
failure_reason: :data_integrity_failure)
transaction do
update_columns(status: :failed, failure_reason: :data_integrity_failure)
all_queuing_entries.delete_all
end
end
def degradation_threshold
......
......@@ -5269,4 +5269,23 @@ RSpec.describe Ci::Build do
build.ensure_trace_metadata!
end
end
describe '#doom!' do
subject { build.doom! }
let_it_be(:build) { create(:ci_build, :queued) }
it 'updates status and failure_reason', :aggregate_failures do
subject
expect(build.status).to eq("failed")
expect(build.failure_reason).to eq("data_integrity_failure")
end
it 'drops associated pending build' do
subject
expect(build.reload.queuing_entry).not_to be_present
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment