Skip to content
Snippets Groups Projects
Unverified Commit f83a28ba authored by Marius Bobin's avatar Marius Bobin
Browse files

Replace limit values with constant based ones

parent 9d1b900f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -140,7 +140,9 @@
 
context 'when the metadata record exists' do
before do
create(:ci_build_trace_metadata, build: build, archival_attempts: 10)
create(:ci_build_trace_metadata,
build: build,
archival_attempts: Ci::BuildTraceMetadata::MAX_ATTEMPTS + 1)
end
 
it 'returns false' do
Loading
Loading
@@ -161,14 +163,15 @@
 
context 'when the metadata record exists' do
before do
create(:ci_build_trace_metadata, build: build, archival_attempts: 10)
create(:ci_build_trace_metadata,
build: build,
archival_attempts: Ci::BuildTraceMetadata::MAX_ATTEMPTS + 1)
end
 
it 'increments its value' do
expect { trace.increment_archival_attempts! }
.to change { build.reload.trace_metadata&.archival_attempts }
.from(10)
.to(11)
.by(1)
end
end
end
Loading
Loading
Loading
Loading
@@ -16,14 +16,14 @@
.attempts_available?
end
 
context 'when archival_attempts is less than 5' do
let(:archival_attempts) { 0 }
context 'when archival_attempts is less than the limit' do
let(:archival_attempts) { described_class::MAX_ATTEMPTS - 1 }
 
it { is_expected.to be_truthy }
end
 
context 'when archival_attempts is more than 5' do
let(:archival_attempts) { 6 }
context 'when archival_attempts is over the limit' do
let(:archival_attempts) { described_class::MAX_ATTEMPTS + 1 }
 
it { is_expected.to be_falsey }
end
Loading
Loading
Loading
Loading
@@ -62,7 +62,9 @@
 
context 'when the job is out of archival attempts' do
before do
create(:ci_build_trace_metadata, build: job, archival_attempts: 6)
create(:ci_build_trace_metadata,
build: job,
archival_attempts: Ci::BuildTraceMetadata::MAX_ATTEMPTS + 1)
end
 
it 'skips archiving' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment