diff --git a/spec/tooling/danger/stable_branch_spec.rb b/spec/tooling/danger/stable_branch_spec.rb index fc644413a5a45023949ea17381e9a7ae036aa7c0..439a878a5e60e341218f92c224538236615d8a47 100644 --- a/spec/tooling/danger/stable_branch_spec.rb +++ b/spec/tooling/danger/stable_branch_spec.rb @@ -241,13 +241,23 @@ context 'when not an applicable version' do let(:target_branch) { '14-9-stable-ee' } - it_behaves_like 'with a warning', described_class::VERSION_WARNING_MESSAGE + it 'warns about the package-and-test pipeline and the version' do + expect(stable_branch).to receive(:warn).with(described_class::WARN_PACKAGE_AND_TEST_MESSAGE) + expect(stable_branch).to receive(:warn).with(described_class::VERSION_WARNING_MESSAGE) + + subject + end end context 'when the version API request fails' do let(:response_success) { false } - it_behaves_like 'with a warning', described_class::FAILED_VERSION_REQUEST_MESSAGE + it 'warns about the package-and-test pipeline and the version request' do + expect(stable_branch).to receive(:warn).with(described_class::WARN_PACKAGE_AND_TEST_MESSAGE) + expect(stable_branch).to receive(:warn).with(described_class::FAILED_VERSION_REQUEST_MESSAGE) + + subject + end end context 'when more than one page of versions is needed' do @@ -293,6 +303,7 @@ it 'adds a warning' do expect(HTTParty).to receive(:get).and_return(version_response).at_least(10).times + expect(stable_branch).to receive(:warn).with(described_class::WARN_PACKAGE_AND_TEST_MESSAGE) expect(stable_branch).to receive(:warn).with(described_class::FAILED_VERSION_REQUEST_MESSAGE) subject diff --git a/tooling/danger/stable_branch.rb b/tooling/danger/stable_branch.rb index 9deb4838079e0f92455aa93d453800a7afc6b4eb..bba198d1310fbe709e30de6a2dc47971dc1cbe45 100644 --- a/tooling/danger/stable_branch.rb +++ b/tooling/danger/stable_branch.rb @@ -74,7 +74,7 @@ def check! if status.nil? || FAILING_PACKAGE_AND_TEST_STATUSES.include?(status) # rubocop:disable Style/GuardClause fail NEEDS_PACKAGE_AND_TEST_MESSAGE else - warn WARN_PACKAGE_AND_TEST_MESSAGE unless status == 'success' + warn WARN_PACKAGE_AND_TEST_MESSAGE end end # rubocop:enable Style/SignalException @@ -110,7 +110,7 @@ def package_and_test_bridge(mr_head_pipeline_id) gitlab .api .pipeline_bridges(helper.mr_target_project_id, mr_head_pipeline_id) - &.find { |bridge| bridge['name'].include?('package-and-test') } + &.find { |bridge| bridge['name'].include?('package-and-test-ee') } end def stable_target_branch