Dependencies Validator fails when depended job is manual
This commit is contained in:
parent
9daeccfb3a
commit
1def948bd0
3 changed files with 7 additions and 10 deletions
|
@ -491,7 +491,6 @@ module Ci
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_dependency?
|
def valid_dependency?
|
||||||
return false unless complete?
|
|
||||||
return false if artifacts_expired?
|
return false if artifacts_expired?
|
||||||
return false if erased?
|
return false if erased?
|
||||||
|
|
||||||
|
|
|
@ -1861,9 +1861,9 @@ describe Ci::Build do
|
||||||
describe 'state transition: any => [:running]' do
|
describe 'state transition: any => [:running]' do
|
||||||
shared_examples 'validation is active' do
|
shared_examples 'validation is active' do
|
||||||
context 'when depended job has not been completed yet' do
|
context 'when depended job has not been completed yet' do
|
||||||
let!(:pre_stage_job) { create(:ci_build, :running, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
let!(:pre_stage_job) { create(:ci_build, :manual, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
||||||
|
|
||||||
it { expect { job.run! }.to raise_error(Ci::Build::MissingDependenciesError) }
|
it { expect { job.run! }.not_to raise_error(Ci::Build::MissingDependenciesError) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when artifacts of depended job has been expired' do
|
context 'when artifacts of depended job has been expired' do
|
||||||
|
@ -1885,11 +1885,10 @@ describe Ci::Build do
|
||||||
|
|
||||||
shared_examples 'validation is not active' do
|
shared_examples 'validation is not active' do
|
||||||
context 'when depended job has not been completed yet' do
|
context 'when depended job has not been completed yet' do
|
||||||
let!(:pre_stage_job) { create(:ci_build, :running, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
let!(:pre_stage_job) { create(:ci_build, :manual, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
||||||
|
|
||||||
it { expect { job.run! }.not_to raise_error }
|
it { expect { job.run! }.not_to raise_error }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when artifacts of depended job has been expired' do
|
context 'when artifacts of depended job has been expired' do
|
||||||
let!(:pre_stage_job) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
let!(:pre_stage_job) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
||||||
|
|
||||||
|
|
|
@ -287,9 +287,9 @@ module Ci
|
||||||
|
|
||||||
shared_examples 'validation is active' do
|
shared_examples 'validation is active' do
|
||||||
context 'when depended job has not been completed yet' do
|
context 'when depended job has not been completed yet' do
|
||||||
let!(:pre_stage_job) { create(:ci_build, :running, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
let!(:pre_stage_job) { create(:ci_build, :manual, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
||||||
|
|
||||||
it_behaves_like 'not pick'
|
it { expect(subject).to eq(pending_job) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when artifacts of depended job has been expired' do
|
context 'when artifacts of depended job has been expired' do
|
||||||
|
@ -309,7 +309,7 @@ module Ci
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when job object is staled' do
|
context 'when job object is staled' do
|
||||||
let!(:pre_stage_job) { create(:ci_build, :running, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
let!(:pre_stage_job) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(Ci::Build).to receive(:drop!)
|
allow_any_instance_of(Ci::Build).to receive(:drop!)
|
||||||
|
@ -324,11 +324,10 @@ module Ci
|
||||||
|
|
||||||
shared_examples 'validation is not active' do
|
shared_examples 'validation is not active' do
|
||||||
context 'when depended job has not been completed yet' do
|
context 'when depended job has not been completed yet' do
|
||||||
let!(:pre_stage_job) { create(:ci_build, :running, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
let!(:pre_stage_job) { create(:ci_build, :manual, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
||||||
|
|
||||||
it { expect(subject).to eq(pending_job) }
|
it { expect(subject).to eq(pending_job) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when artifacts of depended job has been expired' do
|
context 'when artifacts of depended job has been expired' do
|
||||||
let!(:pre_stage_job) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
let!(:pre_stage_job) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test', stage_idx: 0) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue