summaryrefslogtreecommitdiff
path: root/spec/serializers/build_details_entity_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
commit36a59d088eca61b834191dacea009677a96c052f (patch)
treee4f33972dab5d8ef79e3944a9f403035fceea43f /spec/serializers/build_details_entity_spec.rb
parenta1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff)
downloadgitlab-ce-36a59d088eca61b834191dacea009677a96c052f.tar.gz
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/serializers/build_details_entity_spec.rb')
-rw-r--r--spec/serializers/build_details_entity_spec.rb47
1 files changed, 37 insertions, 10 deletions
diff --git a/spec/serializers/build_details_entity_spec.rb b/spec/serializers/build_details_entity_spec.rb
index da2734feb51..dd8238456aa 100644
--- a/spec/serializers/build_details_entity_spec.rb
+++ b/spec/serializers/build_details_entity_spec.rb
@@ -127,21 +127,48 @@ RSpec.describe BuildDetailsEntity do
end
context 'when the build has failed due to a missing dependency' do
- let!(:test1) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test1', stage_idx: 0) }
- let!(:test2) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test2', stage_idx: 1) }
- let!(:build) { create(:ci_build, :pending, pipeline: pipeline, stage_idx: 2, options: { dependencies: %w(test1 test2) }) }
let(:message) { subject[:callout_message] }
- before do
- build.pipeline.unlocked!
- build.drop!(:missing_dependency_failure)
+ context 'when the dependency is in the same pipeline' do
+ let!(:test1) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test1', stage_idx: 0) }
+ let!(:test2) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test2', stage_idx: 1) }
+ let!(:build) { create(:ci_build, :pending, pipeline: pipeline, stage_idx: 2, options: { dependencies: %w(test1 test2) }) }
+
+ before do
+ build.pipeline.unlocked!
+ build.drop!(:missing_dependency_failure)
+ end
+
+ it { is_expected.to include(failure_reason: 'missing_dependency_failure') }
+
+ it 'includes the failing dependencies in the callout message' do
+ expect(message).to include('test1')
+ expect(message).to include('test2')
+ end
+
+ it 'includes message for list of invalid dependencies' do
+ expect(message).to include('could not retrieve the needed artifacts:')
+ end
end
- it { is_expected.to include(failure_reason: 'missing_dependency_failure') }
+ context 'when dependency is not found' do
+ let!(:build) { create(:ci_build, :pending, pipeline: pipeline, stage_idx: 2, options: { dependencies: %w(test1 test2) }) }
+
+ before do
+ build.pipeline.unlocked!
+ build.drop!(:missing_dependency_failure)
+ end
- it 'includes the failing dependencies in the callout message' do
- expect(message).to include('test1')
- expect(message).to include('test2')
+ it { is_expected.to include(failure_reason: 'missing_dependency_failure') }
+
+ it 'excludes the failing dependencies in the callout message' do
+ expect(message).not_to include('test1')
+ expect(message).not_to include('test2')
+ end
+
+ it 'includes the correct punctuation in the message' do
+ expect(message).to include('could not retrieve the needed artifacts.')
+ end
end
end