Commit 39365331 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix/gb/sticky-trace-validation' into 'master'

Make build trace correctness validation sticky

See merge request gitlab-org/gitlab!44019
parents aa1dd6f5 a0869a7e
......@@ -70,7 +70,9 @@ module Ci
end
def validate_build_trace!
if chunks_persisted?
return unless has_chunks?
unless live_chunks_pending?
metrics.increment_trace_operation(operation: :finalized)
end
......@@ -110,8 +112,8 @@ module Ci
build.trace_chunks.live.any?
end
def chunks_persisted?
build.trace_chunks.any? && !live_chunks_pending?
def has_chunks?
build.trace_chunks.any?
end
def pending_state_outdated?
......
......@@ -83,6 +83,23 @@ RSpec.describe Ci::UpdateBuildStateService do
{ checksum: 'crc32:12345678', state: 'failed', failure_reason: 'script_failure' }
end
context 'when build does not have associated trace chunks' do
it 'updates a build status' do
result = subject.execute
expect(build).to be_failed
expect(result.status).to eq 200
end
it 'does not increment invalid trace metric' do
execute_with_stubbed_metrics!
expect(metrics)
.not_to have_received(:increment_trace_operation)
.with(operation: :invalid)
end
end
context 'when build trace has been migrated' do
before do
create(:ci_build_trace_chunk, :persisted, build: build, initial_data: 'abcd')
......
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