diff options
author | João Cunha <j.a.cunha@gmail.com> | 2019-07-04 11:17:53 +0100 |
---|---|---|
committer | João Cunha <j.a.cunha@gmail.com> | 2019-07-04 11:17:53 +0100 |
commit | 83154e0c076b652a360b1abf292024b82578e6a3 (patch) | |
tree | 64f2800343dae52d60bf2627f1ac16893c23559e | |
parent | 589dcf9e4cc9768f557903321ca3632abd0c5d90 (diff) | |
download | gitlab-ce-83154e0c076b652a360b1abf292024b82578e6a3.tar.gz |
Pause ci_runner on application_runner prepare_uninstall
-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) } |