From 6a66e4a1f116ff98d8f9b8dffa3beed62d74e0b3 Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Mon, 26 Nov 2018 14:54:44 +0100 Subject: Don't remove failed install pods We want to keep failed install pods around so that it is easier to debug why a failure occured. With this change we also need to ensure that we remove a previous pod with the same name before installing so that re-install does not fail. Another change here is that we no longer need to catch errors from delete_pod! in CheckInstallationProgressService as we now catch the ResourceNotFoundError in Helm::Api. The catch statement in CheckInstallationProgressService was also probably too broad before and should have been narrowed down simply to ResourceNotFoundError. --- .../check_installation_progress_service_spec.rb | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'spec/services') 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 ea17f2bb423..9452a9e38fb 100644 --- a/spec/services/clusters/applications/check_installation_progress_service_spec.rb +++ b/spec/services/clusters/applications/check_installation_progress_service_spec.rb @@ -8,14 +8,6 @@ describe Clusters::Applications::CheckInstallationProgressService do let(:phase) { Gitlab::Kubernetes::Pod::UNKNOWN } let(:errors) { nil } - shared_examples 'a terminated installation' do - it 'removes the installation POD' do - expect(service).to receive(:remove_installation_pod).once - - service.execute - end - end - shared_examples 'a not yet terminated installation' do |a_phase| let(:phase) { a_phase } @@ -39,15 +31,13 @@ describe Clusters::Applications::CheckInstallationProgressService do context 'when timeouted' do let(:application) { create(:clusters_applications_helm, :timeouted) } - it_behaves_like 'a terminated installation' - it 'make the application errored' do expect(ClusterWaitForAppInstallationWorker).not_to receive(:perform_in) service.execute expect(application).to be_errored - expect(application.status_reason).to match(/\btimed out\b/) + expect(application.status_reason).to eq("Installation timed out. Check pod logs for install-helm for more details.") end end end @@ -66,7 +56,11 @@ describe Clusters::Applications::CheckInstallationProgressService do expect(service).to receive(:installation_phase).once.and_return(phase) end - it_behaves_like 'a terminated installation' + it 'removes the installation POD' do + expect(service).to receive(:remove_installation_pod).once + + service.execute + end it 'make the application installed' do expect(ClusterWaitForAppInstallationWorker).not_to receive(:perform_in) @@ -86,13 +80,11 @@ describe Clusters::Applications::CheckInstallationProgressService do expect(service).to receive(:installation_phase).once.and_return(phase) end - it_behaves_like 'a terminated installation' - it 'make the application errored' do service.execute expect(application).to be_errored - expect(application.status_reason).to eq("Installation failed") + expect(application.status_reason).to eq("Installation failed. Check pod logs for install-helm for more details.") end end -- cgit v1.2.3