diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-28 12:08:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-28 12:08:26 +0300 |
commit | 4a372de7753b16d254dc319a6bad08ecac0273af (patch) | |
tree | 5590370af8341c1ac1a67d6a3f6c1feccf57b85f /spec/serializers | |
parent | 55e4390933a4e16f8936604d763a6353f088c4c1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/build_details_entity_spec.rb | 47 |
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 |