summaryrefslogtreecommitdiff
path: root/spec/models/clusters
diff options
context:
space:
mode:
authorJoão Cunha <j.a.cunha@gmail.com>2019-07-16 16:11:10 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2019-07-16 16:11:10 +0000
commitbd31c4be0d7cfcb0c2cc887a66c313c592ce8e88 (patch)
tree562be9be26b3bfdcba69e0ea1400f772a149e96b /spec/models/clusters
parentcca71da16ac12d3df787de3f3a0cd60d30649a1d (diff)
downloadgitlab-ce-bd31c4be0d7cfcb0c2cc887a66c313c592ce8e88.tar.gz
Enable GitLabb runner to be uninstalled from cluster
- Set as uninstallable app - Update docs - Adjust specs
Diffstat (limited to 'spec/models/clusters')
-rw-r--r--spec/models/clusters/applications/runner_spec.rb33
1 files changed, 32 insertions, 1 deletions
diff --git a/spec/models/clusters/applications/runner_spec.rb b/spec/models/clusters/applications/runner_spec.rb
index 4f0cd0efe9c..4abe45a2152 100644
--- a/spec/models/clusters/applications/runner_spec.rb
+++ b/spec/models/clusters/applications/runner_spec.rb
@@ -18,7 +18,7 @@ describe Clusters::Applications::Runner do
subject { gitlab_runner.can_uninstall? }
- it { is_expected.to be_falsey }
+ it { is_expected.to be_truthy }
end
describe '#install_command' do
@@ -156,4 +156,35 @@ describe Clusters::Applications::Runner do
end
end
end
+
+ 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) }
+
+ it 'calls prepare_uninstall' do
+ expect_any_instance_of(described_class).to receive(:prepare_uninstall).and_call_original
+
+ subject.make_uninstalling!
+ end
+ end
+
+ describe '#post_uninstall' do
+ it 'destroys its runner' do
+ application_runner = create(:clusters_applications_runner, :scheduled, runner: ci_runner)
+
+ expect { application_runner.post_uninstall }.to change { Ci::Runner.count }.by(-1)
+ end
+ end
end