diff options
-rw-r--r-- | app/models/clusters/applications/runner.rb | 1 | ||||
-rw-r--r-- | spec/models/clusters/applications/runner_spec.rb | 15 |
2 files changed, 15 insertions, 1 deletions
diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb index 4bced718632..1995b0f2cb3 100644 --- a/app/models/clusters/applications/runner.rb +++ b/app/models/clusters/applications/runner.rb @@ -42,6 +42,7 @@ module Clusters def prepare_uninstall runner.builds.cancelable.each(&:cancel) + runner.update(active: false) end private diff --git a/spec/models/clusters/applications/runner_spec.rb b/spec/models/clusters/applications/runner_spec.rb index 0a32c2acd6c..b9851ef3219 100644 --- a/spec/models/clusters/applications/runner_spec.rb +++ b/spec/models/clusters/applications/runner_spec.rb @@ -157,7 +157,20 @@ describe Clusters::Applications::Runner do end end - describe '#make_installing!' do + describe '#prepare_uninstall' do + it 'pauses associated runner' do + active_runner = create(:ci_runner, contacted_at: 1.second.ago) + + expect(active_runner.status).to eq(:online) + + application_runner = create(:clusters_applications_runner, :scheduled, runner: active_runner) + application_runner.prepare_uninstall + + expect(active_runner.status).to eq(:paused) + end + end + + describe '#make_uninstalling!' do subject { create(:clusters_applications_runner, :scheduled, runner: ci_runner) } let(:other_runner) { create(:ci_runner) } |