summaryrefslogtreecommitdiff
path: root/spec/services/clusters/applications/check_ingress_ip_address_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/clusters/applications/check_ingress_ip_address_service_spec.rb')
-rw-r--r--spec/services/clusters/applications/check_ingress_ip_address_service_spec.rb24
1 files changed, 5 insertions, 19 deletions
diff --git a/spec/services/clusters/applications/check_ingress_ip_address_service_spec.rb b/spec/services/clusters/applications/check_ingress_ip_address_service_spec.rb
index a9915493d42..e14c82d32d4 100644
--- a/spec/services/clusters/applications/check_ingress_ip_address_service_spec.rb
+++ b/spec/services/clusters/applications/check_ingress_ip_address_service_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
describe Clusters::Applications::CheckIngressIpAddressService do
- subject { service.execute }
let(:application) { create(:clusters_applications_ingress, :installed) }
let(:service) { described_class.new(application) }
let(:kubeclient) { double(::Kubeclient::Client, get_service: kube_service) }
@@ -20,6 +19,8 @@ describe Clusters::Applications::CheckIngressIpAddressService do
)
end
+ subject { service.execute }
+
before do
allow(application.cluster).to receive(:kubeclient).and_return(kubeclient)
allow(Gitlab::ExclusiveLease)
@@ -30,8 +31,6 @@ describe Clusters::Applications::CheckIngressIpAddressService do
describe '#execute' do
context 'when the ingress ip address is available' do
- it { is_expected.to eq(true) }
-
it 'updates the external_ip for the app' do
subject
@@ -42,7 +41,9 @@ describe Clusters::Applications::CheckIngressIpAddressService do
context 'when the ingress ip address is not available' do
let(:ingress) { nil }
- it { is_expected.to eq(false) }
+ it 'does not error' do
+ subject
+ end
end
context 'when the exclusive lease cannot be obtained' do
@@ -52,8 +53,6 @@ describe Clusters::Applications::CheckIngressIpAddressService do
.and_return(false)
end
- it { is_expected.to eq(true) }
-
it 'does not call kubeclient' do
subject
@@ -64,24 +63,11 @@ describe Clusters::Applications::CheckIngressIpAddressService do
context 'when there is already an external_ip' do
let(:application) { create(:clusters_applications_ingress, :installed, external_ip: '001.111.002.111') }
- it { is_expected.to eq(true) }
-
it 'does not call kubeclient' do
subject
expect(kubeclient).not_to have_received(:get_service)
end
end
-
- context 'when a kubernetes error occurs' do
- before do
- allow(kubeclient).to receive(:get_service).and_raise(KubeException.new(500, 'something blew up', nil))
- end
-
- it 'it raises Clusters::Applications::CheckIngressIpAddressServiceError' do
- expect { subject }
- .to raise_error(Clusters::Applications::CheckIngressIpAddressService::Error, "KubeException: something blew up")
- end
- end
end
end