Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/ci/destroy_pipeline_service_spec.rb')
-rw-r--r--spec/services/ci/destroy_pipeline_service_spec.rb20
1 files changed, 14 insertions, 6 deletions
diff --git a/spec/services/ci/destroy_pipeline_service_spec.rb b/spec/services/ci/destroy_pipeline_service_spec.rb
index 045051c7152..6bd7fe7559c 100644
--- a/spec/services/ci/destroy_pipeline_service_spec.rb
+++ b/spec/services/ci/destroy_pipeline_service_spec.rb
@@ -90,15 +90,23 @@ RSpec.describe ::Ci::DestroyPipelineService do
end
end
- context 'when pipeline is in cancelable state' do
- before do
- allow(pipeline).to receive(:cancelable?).and_return(true)
- end
+ context 'when pipeline is in cancelable state', :sidekiq_inline do
+ let!(:build) { create(:ci_build, :running, pipeline: pipeline) }
+ let!(:child_pipeline) { create(:ci_pipeline, :running, child_of: pipeline) }
+ let!(:child_build) { create(:ci_build, :running, pipeline: child_pipeline) }
+
+ it 'cancels the pipelines sync' do
+ # turn off deletion for all instances of pipeline to allow for testing cancellation
+ allow(pipeline).to receive_message_chain(:reset, :destroy!)
+ allow_next_found_instance_of(Ci::Pipeline) { |p| allow(p).to receive_message_chain(:reset, :destroy!) }
- it 'cancels the pipeline' do
- expect(pipeline).to receive(:cancel_running)
+ # ensure cancellation happens sync so we accumulate minutes
+ expect(::Ci::CancelPipelineWorker).not_to receive(:perform)
subject
+
+ expect(build.reload.status).to eq('canceled')
+ expect(child_build.reload.status).to eq('canceled')
end
end
end