Commit 16d7106f authored by Furkan Ayhan's avatar Furkan Ayhan

Change failure message of missing job needs

It was not clear before, now we decided to make it self-explanatory
parent b9037bae
---
title: Change failure message of missing job needs
merge_request: 50492
author:
type: other
......@@ -134,7 +134,7 @@ module Gitlab
stage.seeds_names.include?(need[:name])
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
......
......@@ -247,7 +247,7 @@ RSpec.describe Gitlab::Ci::Lint do
include_context 'advanced validations' do
it 'runs advanced logical validations' do
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
......
......@@ -966,7 +966,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do
it "returns an error" do
expect(subject.errors).to contain_exactly(
"rspec: needs 'build'")
"'rspec' job needs 'build' job, but it was not added to the pipeline")
end
end
......
......@@ -62,7 +62,8 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Pipeline do
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
......
......@@ -108,7 +108,7 @@ RSpec.describe Ci::CreatePipelineService do
it_behaves_like 'returns a non persisted pipeline'
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.errors).not_to be_empty
......
......@@ -1705,9 +1705,11 @@ RSpec.describe Ci::CreatePipelineService do
shared_examples 'has errors' do
it 'contains the expected errors' do
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'")
expect(pipeline.errors[:base]).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.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
......
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