diff options
author | João Cunha <j.a.cunha@gmail.com> | 2019-07-11 12:23:00 +0100 |
---|---|---|
committer | João Cunha <j.a.cunha@gmail.com> | 2019-07-11 12:27:46 +0100 |
commit | ee2c20f9d0425b0b0aaf5a19b990fea88e0dccaa (patch) | |
tree | c3fe43361116ad76cbc6626ecadacbf27ee5fc74 | |
parent | 13836176b94d4bb39fda8154f6bc90e76647e5de (diff) | |
download | gitlab-ce-60666-kubernetes-applications-uninstall-runner.tar.gz |
Skip canceling builds60666-kubernetes-applications-uninstall-runner
-rw-r--r-- | app/models/clusters/applications/runner.rb | 4 | ||||
-rw-r--r-- | 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 |