From ee2c20f9d0425b0b0aaf5a19b990fea88e0dccaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Cunha?= Date: Thu, 11 Jul 2019 12:23:00 +0100 Subject: Skip canceling builds --- app/models/clusters/applications/runner.rb | 4 +--- spec/models/clusters/applications/runner_spec.rb | 17 ++--------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb index 9074a2638ec..6ae8c3bd7f3 100644 --- a/app/models/clusters/applications/runner.rb +++ b/app/models/clusters/applications/runner.rb @@ -41,9 +41,7 @@ module Clusters end def prepare_uninstall - runner.builds.cancelable.each(&:cancel!) - - runner.update!(active: false) + runner&.update!(active: false) end def post_uninstall diff --git a/spec/models/clusters/applications/runner_spec.rb b/spec/models/clusters/applications/runner_spec.rb index f239212bf0f..4abe45a2152 100644 --- a/spec/models/clusters/applications/runner_spec.rb +++ b/spec/models/clusters/applications/runner_spec.rb @@ -173,24 +173,11 @@ describe Clusters::Applications::Runner do describe '#make_uninstalling!' do subject { create(:clusters_applications_runner, :scheduled, runner: ci_runner) } - let(:other_runner) { create(:ci_runner) } - let(:build) { create(:ci_build, :running, runner: subject.runner) } - let(:other_runner_build) { create(:ci_build, :running, runner: other_runner, project: build.project) } - - before do - expect(build.runner).not_to eq(other_runner_build.runner) - expect(build.project).to eq(other_runner_build.project) + it 'calls prepare_uninstall' do + expect_any_instance_of(described_class).to receive(:prepare_uninstall).and_call_original subject.make_uninstalling! end - - it 'cancels builds of associated runner' do - expect(build.reload).to be_canceled - end - - it 'does not cancel other runner builds' do - expect(other_runner_build.reload).not_to be_canceled - end end describe '#post_uninstall' do -- cgit v1.2.1