summaryrefslogtreecommitdiff
path: root/spec/services/ci
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-01 11:56:00 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-01 11:56:00 +0000
commitf12386aa9acf19877161bfc77e55572f40509cc4 (patch)
treec54e5216f4a7a71fb446e7c3708cb6941a291ce2 /spec/services/ci
parentb64b61bfe72c54fe4a7fdce34b2f1591e3822e5e (diff)
downloadgitlab-ce-f12386aa9acf19877161bfc77e55572f40509cc4.tar.gz
Add latest changes from gitlab-org/security/gitlab@15-5-stable-ee
Diffstat (limited to 'spec/services/ci')
-rw-r--r--spec/services/ci/retry_pipeline_service_spec.rb23
1 files changed, 20 insertions, 3 deletions
diff --git a/spec/services/ci/retry_pipeline_service_spec.rb b/spec/services/ci/retry_pipeline_service_spec.rb
index 0a1e767539d..96437290ae3 100644
--- a/spec/services/ci/retry_pipeline_service_spec.rb
+++ b/spec/services/ci/retry_pipeline_service_spec.rb
@@ -313,10 +313,27 @@ RSpec.describe Ci::RetryPipelineService, '#execute' do
create(:ci_sources_pipeline, pipeline: pipeline, source_job: bridge)
end
- it 'marks source bridge as pending' do
- service.execute(pipeline)
+ context 'without permission' do
+ it 'does nothing to the bridge' do
+ expect { service.execute(pipeline) }.to not_change { bridge.reload.status }
+ .and not_change { bridge.reload.user }
+ end
+ end
+
+ context 'with permission' do
+ let!(:bridge_pipeline) { create(:ci_pipeline, project: create(:project)) }
+ let!(:bridge) do
+ create(:ci_bridge, :strategy_depend, status: 'success', pipeline: bridge_pipeline)
+ end
- expect(bridge.reload).to be_pending
+ before do
+ bridge_pipeline.project.add_maintainer(user)
+ end
+
+ it 'marks source bridge as pending' do
+ expect { service.execute(pipeline) }.to change { bridge.reload.status }.to('pending')
+ .and not_change { bridge.reload.user }
+ end
end
end