Commit ac9d1a5a authored by Thong Kuah's avatar Thong Kuah

Merge branch '23531-change-needs-failure-message' into 'master'

Change failure message of missing job needs

See merge request gitlab-org/gitlab!50492
parents a47d17f6 16d7106f
---
title: Change failure message of missing job needs
merge_request: 50492
author:
type: other
...@@ -134,7 +134,7 @@ module Gitlab ...@@ -134,7 +134,7 @@ module Gitlab
stage.seeds_names.include?(need[:name]) stage.seeds_names.include?(need[:name])
end end
"#{name}: needs '#{need[:name]}'" unless result "'#{name}' job needs '#{need[:name]}' job, but it was not added to the pipeline" unless result
end.compact end.compact
end end
......
...@@ -247,7 +247,7 @@ RSpec.describe Gitlab::Ci::Lint do ...@@ -247,7 +247,7 @@ RSpec.describe Gitlab::Ci::Lint do
include_context 'advanced validations' do include_context 'advanced validations' do
it 'runs advanced logical validations' do it 'runs advanced logical validations' do
expect(subject).not_to be_valid expect(subject).not_to be_valid
expect(subject.errors).to eq(["test: needs 'build'"]) expect(subject.errors).to eq(["'test' job needs 'build' job, but it was not added to the pipeline"])
end end
end end
......
...@@ -966,7 +966,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do ...@@ -966,7 +966,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do
it "returns an error" do it "returns an error" do
expect(subject.errors).to contain_exactly( expect(subject.errors).to contain_exactly(
"rspec: needs 'build'") "'rspec' job needs 'build' job, but it was not added to the pipeline")
end end
end end
......
...@@ -62,7 +62,8 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Pipeline do ...@@ -62,7 +62,8 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Pipeline do
needs_attributes: [{ name: 'non-existent', artifacts: true }] needs_attributes: [{ name: 'non-existent', artifacts: true }]
} }
expect(seed.errors).to contain_exactly("invalid_job: needs 'non-existent'") expect(seed.errors).to contain_exactly(
"'invalid_job' job needs 'non-existent' job, but it was not added to the pipeline")
end end
end end
end end
......
...@@ -108,7 +108,7 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -108,7 +108,7 @@ RSpec.describe Ci::CreatePipelineService do
it_behaves_like 'returns a non persisted pipeline' it_behaves_like 'returns a non persisted pipeline'
it 'returns a pipeline with errors', :aggregate_failures do it 'returns a pipeline with errors', :aggregate_failures do
error_message = "test: needs 'build'" error_message = "'test' job needs 'build' job, but it was not added to the pipeline"
expect(subject.error_messages.map(&:content)).to eq([error_message]) expect(subject.error_messages.map(&:content)).to eq([error_message])
expect(subject.errors).not_to be_empty expect(subject.errors).not_to be_empty
......
...@@ -1713,9 +1713,11 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -1713,9 +1713,11 @@ RSpec.describe Ci::CreatePipelineService do
shared_examples 'has errors' do shared_examples 'has errors' do
it 'contains the expected errors' do it 'contains the expected errors' do
expect(pipeline.builds).to be_empty expect(pipeline.builds).to be_empty
expect(pipeline.yaml_errors).to eq("test_a: needs 'build_a'")
expect(pipeline.error_messages.map(&:content)).to contain_exactly("test_a: needs 'build_a'") error_message = "'test_a' job needs 'build_a' job, but it was not added to the pipeline"
expect(pipeline.errors[:base]).to contain_exactly("test_a: needs 'build_a'") expect(pipeline.yaml_errors).to eq(error_message)
expect(pipeline.error_messages.map(&:content)).to contain_exactly(error_message)
expect(pipeline.errors[:base]).to contain_exactly(error_message)
end 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