summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-02-20 13:49:35 +1100
committerDylan Griffith <dyl.griffith@gmail.com>2018-02-20 13:49:35 +1100
commit3d3d09fa9d0ea81f0e20037f64bd43b0cd1e5891 (patch)
tree37f859e6c9a857d7173a9a49aec6645fed89293e /spec
parentba4114d25f538d198df2f681b9cb08567494207e (diff)
downloadgitlab-ce-3d3d09fa9d0ea81f0e20037f64bd43b0cd1e5891.tar.gz
Schedule Ingress IP address fetch from K8s after clusters page load (#42643)
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/clusters_controller_spec.rb6
-rw-r--r--spec/models/clusters/applications/ingress_spec.rb29
2 files changed, 35 insertions, 0 deletions
diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb
index 954fc79f57d..617c1471239 100644
--- a/spec/controllers/projects/clusters_controller_spec.rb
+++ b/spec/controllers/projects/clusters_controller_spec.rb
@@ -91,6 +91,12 @@ describe Projects::ClustersController do
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('cluster_status')
end
+
+ it 'invokes sync_details on each application' do
+ expect_any_instance_of(Clusters::Applications::Ingress).to receive(:sync_details)
+
+ go
+ end
end
describe 'security' do
diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb
index c8109bf3cf6..ced5a4ee4d5 100644
--- a/spec/models/clusters/applications/ingress_spec.rb
+++ b/spec/models/clusters/applications/ingress_spec.rb
@@ -22,4 +22,33 @@ describe Clusters::Applications::Ingress do
.with(ClusterWaitForIngressIpAddressWorker::INTERVAL, 'ingress', application.id, 3)
end
end
+
+ describe '#sync_details' do
+ let(:application) { create(:clusters_applications_ingress, :installed) }
+
+ before do
+ application.sync_details
+ end
+
+ it 'schedules a ClusterWaitForIngressIpAddressWorker' do
+ expect(ClusterWaitForIngressIpAddressWorker).to have_received(:perform_in)
+ .with(ClusterWaitForIngressIpAddressWorker::INTERVAL, 'ingress', application.id, 3)
+ end
+
+ context 'when the application is not installed' do
+ let(:application) { create(:clusters_applications_ingress, :installing) }
+
+ it 'does not schedule a ClusterWaitForIngressIpAddressWorker' do
+ expect(ClusterWaitForIngressIpAddressWorker).not_to have_received(:perform_in)
+ end
+ end
+
+ context 'when there is already an external_ip' do
+ let(:application) { create(:clusters_applications_ingress, :installed, external_ip: '111.222.222.111') }
+
+ it 'does not schedule a ClusterWaitForIngressIpAddressWorker' do
+ expect(ClusterWaitForIngressIpAddressWorker).not_to have_received(:perform_in)
+ end
+ end
+ end
end