Commit 91f19e54 authored by Maxime Orefice's avatar Maxime Orefice Committed by Grzegorz Bizon

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

parent d3d80a33
......@@ -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