diff options
Diffstat (limited to 'spec/services/clusters/applications/install_service_spec.rb')
-rw-r--r-- | spec/services/clusters/applications/install_service_spec.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/spec/services/clusters/applications/install_service_spec.rb b/spec/services/clusters/applications/install_service_spec.rb index 054a49ffedf..ad175226e92 100644 --- a/spec/services/clusters/applications/install_service_spec.rb +++ b/spec/services/clusters/applications/install_service_spec.rb @@ -2,17 +2,19 @@ require 'spec_helper' describe Clusters::Applications::InstallService do describe '#execute' do - let(:application) { create(:cluster_applications_helm, :scheduled) } + let(:application) { create(:clusters_applications_helm, :scheduled) } + let!(:install_command) { application.install_command } let(:service) { described_class.new(application) } - let(:helm_client) { instance_double(Gitlab::Kubernetes::Helm) } + let(:helm_client) { instance_double(Gitlab::Kubernetes::Helm::Api) } before do + allow(service).to receive(:install_command).and_return(install_command) allow(service).to receive(:helm_api).and_return(helm_client) end context 'when there are no errors' do before do - expect(helm_client).to receive(:install).with(application.install_command) + expect(helm_client).to receive(:install).with(install_command) allow(ClusterWaitForAppInstallationWorker).to receive(:perform_in).and_return(nil) end @@ -33,7 +35,7 @@ describe Clusters::Applications::InstallService do context 'when k8s cluster communication fails' do before do error = KubeException.new(500, 'system failure', nil) - expect(helm_client).to receive(:install).with(application.install_command).and_raise(error) + expect(helm_client).to receive(:install).with(install_command).and_raise(error) end it 'make the application errored' do @@ -45,7 +47,7 @@ describe Clusters::Applications::InstallService do end context 'when application cannot be persisted' do - let(:application) { build(:cluster_applications_helm, :scheduled) } + let(:application) { build(:clusters_applications_helm, :scheduled) } it 'make the application errored' do expect(application).to receive(:make_installing!).once.and_raise(ActiveRecord::RecordInvalid) |