diff options
author | Thong Kuah <tkuah@gitlab.com> | 2019-04-12 16:22:11 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-04-12 16:22:11 +0300 |
commit | 8dfec0cedd4d623226ee9d058323a13470631bce (patch) | |
tree | 3eaa5de3c486a158ffb8f7934ff430d65483e099 /spec/services/clusters/applications | |
parent | d30ac3259faa6281504971f918793aa195bd0493 (diff) |
Do not rescue errors from state transitions
As this are un-expected errors which we should hear about from Sentry.
Still rescue StandardError when operating a Helm action as we can get
non Kubeclient errors such as SSL certificate or network errors
Diffstat (limited to 'spec/services/clusters/applications')
3 files changed, 6 insertions, 12 deletions
diff --git a/spec/services/clusters/applications/install_service_spec.rb b/spec/services/clusters/applications/install_service_spec.rb index db0c33a95b2..14739ff9e7c 100644 --- a/spec/services/clusters/applications/install_service_spec.rb +++ b/spec/services/clusters/applications/install_service_spec.rb @@ -58,7 +58,7 @@ describe Clusters::Applications::InstallService do let(:error) { StandardError.new('something bad happened') } before do - expect(application).to receive(:make_installing!).once.and_raise(error) + expect(helm_client).to receive(:install).with(install_command).and_raise(error) end include_examples 'logs kubernetes errors' do @@ -68,12 +68,10 @@ describe Clusters::Applications::InstallService do end it 'make the application errored' do - expect(helm_client).not_to receive(:install) - service.execute expect(application).to be_errored - expect(application.status_reason).to eq("Can't start installation process.") + expect(application.status_reason).to eq('Failed to install.') end end end diff --git a/spec/services/clusters/applications/patch_service_spec.rb b/spec/services/clusters/applications/patch_service_spec.rb index 10b1379a127..3ebe0540837 100644 --- a/spec/services/clusters/applications/patch_service_spec.rb +++ b/spec/services/clusters/applications/patch_service_spec.rb @@ -66,16 +66,14 @@ describe Clusters::Applications::PatchService do end before do - expect(application).to receive(:make_updating!).once.and_raise(error) + expect(helm_client).to receive(:update).with(update_command).and_raise(error) end it 'make the application errored' do - expect(helm_client).not_to receive(:update) - service.execute expect(application).to be_update_errored - expect(application.status_reason).to eq("Can't start update process.") + expect(application.status_reason).to eq('Failed to update.') end end end diff --git a/spec/services/clusters/applications/upgrade_service_spec.rb b/spec/services/clusters/applications/upgrade_service_spec.rb index dd2e6e94e4f..a80b1d9127c 100644 --- a/spec/services/clusters/applications/upgrade_service_spec.rb +++ b/spec/services/clusters/applications/upgrade_service_spec.rb @@ -60,7 +60,7 @@ describe Clusters::Applications::UpgradeService do let(:error) { StandardError.new('something bad happened') } before do - expect(application).to receive(:make_updating!).once.and_raise(error) + expect(helm_client).to receive(:update).with(install_command).and_raise(error) end include_examples 'logs kubernetes errors' do @@ -70,12 +70,10 @@ describe Clusters::Applications::UpgradeService do end it 'make the application errored' do - expect(helm_client).not_to receive(:update) - service.execute expect(application).to be_update_errored - expect(application.status_reason).to eq("Can't start upgrade process.") + expect(application.status_reason).to eq('Failed to upgrade.') end end end |