Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2019-09-04 15:07:33 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2019-09-04 15:08:36 +0300
commit0a39a3d4cdaf6ad4a5a031c1ca287cdc555c60ab (patch)
treeb0b5db7da33628ac283898d503da221a74a986c8 /spec/services/ci/create_pipeline_service_spec.rb
parentb76bc2762a245c61089fae486e61c9fd83d45f95 (diff)
Persist `needs:` validation as config error
In case when `needs:` is missing, but when requested by service, we would not save the pipeline with config_error. This makes it explicit that we want to persist the error as `config_error` failure reason.
Diffstat (limited to 'spec/services/ci/create_pipeline_service_spec.rb')
-rw-r--r--spec/services/ci/create_pipeline_service_spec.rb24
1 files changed, 20 insertions, 4 deletions
diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb
index deb68899309..fad865a4811 100644
--- a/spec/services/ci/create_pipeline_service_spec.rb
+++ b/spec/services/ci/create_pipeline_service_spec.rb
@@ -1140,10 +1140,26 @@ describe Ci::CreatePipelineService do
context 'when pipeline on feature is created' do
let(:ref_name) { 'refs/heads/feature' }
- it 'does not create a pipeline as test_a depends on build_a' do
- expect(pipeline).not_to be_persisted
- expect(pipeline.builds).to be_empty
- expect(pipeline.errors[:base]).to contain_exactly("test_a: needs 'build_a'")
+ context 'when save_on_errors is enabled' do
+ let(:pipeline) { execute_service(save_on_errors: true) }
+
+ it 'does create a pipeline as test_a depends on build_a' do
+ expect(pipeline).to be_persisted
+ expect(pipeline.builds).to be_empty
+ expect(pipeline.yaml_errors).to eq("test_a: needs 'build_a'")
+ expect(pipeline.errors[:base]).to contain_exactly("test_a: needs 'build_a'")
+ end
+ end
+
+ context 'when save_on_errors is disabled' do
+ let(:pipeline) { execute_service(save_on_errors: false) }
+
+ it 'does not create a pipeline as test_a depends on build_a' do
+ expect(pipeline).not_to be_persisted
+ expect(pipeline.builds).to be_empty
+ expect(pipeline.yaml_errors).to be_nil
+ expect(pipeline.errors[:base]).to contain_exactly("test_a: needs 'build_a'")
+ end
end
end