Commit 2910f55a authored by João Cunha's avatar João Cunha Committed by Mayra Cabrera

Bring method back that was mistakenly removed

- We're also improving specs to avoid this could happen again
parent d0532536
...@@ -33,6 +33,10 @@ module Clusters ...@@ -33,6 +33,10 @@ module Clusters
def timed_out? def timed_out?
Time.now.utc - app.updated_at.utc > ClusterWaitForAppInstallationWorker::TIMEOUT Time.now.utc - app.updated_at.utc > ClusterWaitForAppInstallationWorker::TIMEOUT
end end
def remove_installation_pod
helm_api.delete_pod!(pod_name)
end
end end
end end
end end
...@@ -15,7 +15,7 @@ module Clusters ...@@ -15,7 +15,7 @@ module Clusters
rescue StandardError => e rescue StandardError => e
app.make_errored!(_('Application uninstalled but failed to destroy: %{error_message}') % { error_message: e.message }) app.make_errored!(_('Application uninstalled but failed to destroy: %{error_message}') % { error_message: e.message })
ensure ensure
remove_installation_pod remove_uninstallation_pod
end end
def check_timeout def check_timeout
...@@ -33,6 +33,10 @@ module Clusters ...@@ -33,6 +33,10 @@ module Clusters
def timed_out? def timed_out?
Time.now.utc - app.updated_at.utc > WaitForUninstallAppWorker::TIMEOUT Time.now.utc - app.updated_at.utc > WaitForUninstallAppWorker::TIMEOUT
end end
def remove_uninstallation_pod
helm_api.delete_pod!(pod_name)
end
end end
end end
end end
---
title: Fix removal of install pods
merge_request: 32667
author:
type: fixed
...@@ -142,7 +142,11 @@ describe Clusters::Applications::CheckInstallationProgressService, '#execute' do ...@@ -142,7 +142,11 @@ describe Clusters::Applications::CheckInstallationProgressService, '#execute' do
end end
it 'removes the installation POD' do 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 service.execute
end end
......
...@@ -47,11 +47,15 @@ describe Clusters::Applications::CheckUninstallProgressService do ...@@ -47,11 +47,15 @@ describe Clusters::Applications::CheckUninstallProgressService do
context 'when installation POD succeeded' do context 'when installation POD succeeded' do
let(:phase) { Gitlab::Kubernetes::Pod::SUCCEEDED } let(:phase) { Gitlab::Kubernetes::Pod::SUCCEEDED }
before do 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) expect(service).to receive(:pod_phase).once.and_return(phase)
end end
it 'removes the installation POD' do 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 service.execute
end end
...@@ -76,7 +80,7 @@ describe Clusters::Applications::CheckUninstallProgressService do ...@@ -76,7 +80,7 @@ describe Clusters::Applications::CheckUninstallProgressService do
end end
it 'still removes the installation POD' do 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 service.execute
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment