summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Cunha <j.a.cunha@gmail.com>2019-09-04 18:47:19 +0100
committerJoão Cunha <j.a.cunha@gmail.com>2019-09-04 20:39:01 +0100
commit0a9cc6abd82079b09f45ace81662eb704564bfe5 (patch)
treeccfbb2f3aba29c49b4c5af9f330d31ce0407168e
parentc3c5d6fba68f2396117c61a7a387be76f6b03996 (diff)
downloadgitlab-ce-fix/regression-remove-installation-pod.tar.gz
Bring method back that was mistakenly removedfix/regression-remove-installation-pod
- We're also improving specs to avoid this could happen again
-rw-r--r--app/services/clusters/applications/check_installation_progress_service.rb4
-rw-r--r--app/services/clusters/applications/check_uninstall_progress_service.rb6
-rw-r--r--changelogs/unreleased/fix-regression-remove-installation-pod.yml5
-rw-r--r--spec/services/clusters/applications/check_installation_progress_service_spec.rb6
-rw-r--r--spec/services/clusters/applications/check_uninstall_progress_service_spec.rb8
5 files changed, 25 insertions, 4 deletions
diff --git a/app/services/clusters/applications/check_installation_progress_service.rb b/app/services/clusters/applications/check_installation_progress_service.rb
index 65d08966802..1ce6e0c1cb0 100644
--- a/app/services/clusters/applications/check_installation_progress_service.rb
+++ b/app/services/clusters/applications/check_installation_progress_service.rb
@@ -33,6 +33,10 @@ module Clusters
def timed_out?
Time.now.utc - app.updated_at.utc > ClusterWaitForAppInstallationWorker::TIMEOUT
end
+
+ def remove_installation_pod
+ helm_api.delete_pod!(pod_name)
+ end
end
end
end
diff --git a/app/services/clusters/applications/check_uninstall_progress_service.rb b/app/services/clusters/applications/check_uninstall_progress_service.rb
index 6a618d61c4f..fe9c488bdfd 100644
--- a/app/services/clusters/applications/check_uninstall_progress_service.rb
+++ b/app/services/clusters/applications/check_uninstall_progress_service.rb
@@ -15,7 +15,7 @@ module Clusters
rescue StandardError => e
app.make_errored!(_('Application uninstalled but failed to destroy: %{error_message}') % { error_message: e.message })
ensure
- remove_installation_pod
+ remove_uninstallation_pod
end
def check_timeout
@@ -33,6 +33,10 @@ module Clusters
def timed_out?
Time.now.utc - app.updated_at.utc > WaitForUninstallAppWorker::TIMEOUT
end
+
+ def remove_uninstallation_pod
+ helm_api.delete_pod!(pod_name)
+ end
end
end
end
diff --git a/changelogs/unreleased/fix-regression-remove-installation-pod.yml b/changelogs/unreleased/fix-regression-remove-installation-pod.yml
new file mode 100644
index 00000000000..1ed72f1189d
--- /dev/null
+++ b/changelogs/unreleased/fix-regression-remove-installation-pod.yml
@@ -0,0 +1,5 @@
+---
+title: Fix removal of install pods
+merge_request: 32667
+author:
+type: fixed
diff --git a/spec/services/clusters/applications/check_installation_progress_service_spec.rb b/spec/services/clusters/applications/check_installation_progress_service_spec.rb
index 464a67649ff..02fd4b63c89 100644
--- a/spec/services/clusters/applications/check_installation_progress_service_spec.rb
+++ b/spec/services/clusters/applications/check_installation_progress_service_spec.rb
@@ -142,7 +142,11 @@ describe Clusters::Applications::CheckInstallationProgressService, '#execute' do
end
it 'removes the installation POD' do
- expect(service).to receive(:remove_installation_pod).once
+ expect_any_instance_of(Gitlab::Kubernetes::Helm::Api)
+ .to receive(:delete_pod!)
+ .with(kind_of(String))
+ .once
+ expect(service).to receive(:remove_installation_pod).and_call_original
service.execute
end
diff --git a/spec/services/clusters/applications/check_uninstall_progress_service_spec.rb b/spec/services/clusters/applications/check_uninstall_progress_service_spec.rb
index 1a9f7089c3d..68ad0208226 100644
--- a/spec/services/clusters/applications/check_uninstall_progress_service_spec.rb
+++ b/spec/services/clusters/applications/check_uninstall_progress_service_spec.rb
@@ -47,11 +47,15 @@ describe Clusters::Applications::CheckUninstallProgressService do
context 'when installation POD succeeded' do
let(:phase) { Gitlab::Kubernetes::Pod::SUCCEEDED }
before do
+ expect_any_instance_of(Gitlab::Kubernetes::Helm::Api)
+ .to receive(:delete_pod!)
+ .with(kind_of(String))
+ .once
expect(service).to receive(:pod_phase).once.and_return(phase)
end
it 'removes the installation POD' do
- expect(service).to receive(:remove_installation_pod).once
+ expect(service).to receive(:remove_uninstallation_pod).and_call_original
service.execute
end
@@ -76,7 +80,7 @@ describe Clusters::Applications::CheckUninstallProgressService do
end
it 'still removes the installation POD' do
- expect(service).to receive(:remove_installation_pod).once
+ expect(service).to receive(:remove_uninstallation_pod).and_call_original
service.execute
end