diff options
author | Thong Kuah <tkuah@gitlab.com> | 2019-04-10 14:50:14 +1200 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-04-29 22:55:11 -0700 |
commit | 938e90f47288901790a96c50a8c0dfa2b7eab137 (patch) | |
tree | b7496ad378885c6aee32b199906386812cedf9d8 /spec/workers | |
parent | 33a765c17a246e4a2376056b1c301707c78806d0 (diff) | |
download | gitlab-ce-938e90f47288901790a96c50a8c0dfa2b7eab137.tar.gz |
Services to uninstall cluster application
+ to monitor progress of uninstallation pod
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/clusters/applications/wait_for_uninstall_app_worker_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/workers/clusters/applications/wait_for_uninstall_app_worker_spec.rb b/spec/workers/clusters/applications/wait_for_uninstall_app_worker_spec.rb new file mode 100644 index 00000000000..aaf5c9defc4 --- /dev/null +++ b/spec/workers/clusters/applications/wait_for_uninstall_app_worker_spec.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Clusters::Applications::WaitForUninstallAppWorker, '#perform' do + let(:app) { create(:clusters_applications_helm) } + let(:app_name) { app.name } + let(:app_id) { app.id } + + subject { described_class.new.perform(app_name, app_id) } + + context 'app exists' do + let(:service) { instance_double(Clusters::Applications::CheckUninstallProgressService) } + + it 'calls the check service' do + expect(Clusters::Applications::CheckUninstallProgressService).to receive(:new).with(app).and_return(service) + expect(service).to receive(:execute).once + + subject + end + end + + context 'app does not exist' do + let(:app_id) { 0 } + + it 'does not call the check service' do + expect(Clusters::Applications::CheckUninstallProgressService).not_to receive(:new) + + expect { subject }.to raise_error(ActiveRecord::RecordNotFound) + end + end +end |