summaryrefslogtreecommitdiff
path: root/spec/models/clusters/applications
diff options
context:
space:
mode:
authorChris Baumbauer <cab@cabnetworks.net>2018-12-16 23:31:38 -0800
committerChris Baumbauer <cab@cabnetworks.net>2019-01-10 14:13:41 -0800
commit1102deb0bd04a1bdf550ed74cf381a6bd400a7e0 (patch)
treed734488f04098bdabbae3ce0621debf0eb6bf918 /spec/models/clusters/applications
parent71026ffd7e71da726a9b740d42093926f8477c3e (diff)
downloadgitlab-ce-1102deb0bd04a1bdf550ed74cf381a6bd400a7e0.tar.gz
Initial Serverless Functions detailed view
Diffstat (limited to 'spec/models/clusters/applications')
-rw-r--r--spec/models/clusters/applications/knative_spec.rb36
1 files changed, 35 insertions, 1 deletions
diff --git a/spec/models/clusters/applications/knative_spec.rb b/spec/models/clusters/applications/knative_spec.rb
index 0cf9e10ce04..35818be8deb 100644
--- a/spec/models/clusters/applications/knative_spec.rb
+++ b/spec/models/clusters/applications/knative_spec.rb
@@ -149,6 +149,35 @@ describe Clusters::Applications::Knative do
it { is_expected.to validate_presence_of(:hostname) }
end
+ describe '#service_pod_details' do
+ let(:cluster) { create(:cluster, :project, :provided_by_gcp) }
+ let(:service) { cluster.platform_kubernetes }
+ let(:knative) { create(:clusters_applications_knative, cluster: cluster) }
+
+ let(:namespace) do
+ create(:cluster_kubernetes_namespace,
+ cluster: cluster,
+ cluster_project: cluster.cluster_project,
+ project: cluster.cluster_project.project)
+ end
+
+ before do
+ stub_kubeclient_discover(service.api_url)
+ stub_kubeclient_knative_services
+ stub_kubeclient_service_pods
+ stub_reactive_cache(knative,
+ {
+ services: kube_response(kube_knative_services_body),
+ pods: kube_response(kube_knative_pods_body(cluster.cluster_project.project.name, namespace.namespace))
+ })
+ synchronous_reactive_cache(knative)
+ end
+
+ it 'should be able k8s core for pod details' do
+ expect(knative.service_pod_details(namespace.namespace, cluster.cluster_project.project.name)).not_to be_nil
+ end
+ end
+
describe '#services' do
let(:cluster) { create(:cluster, :project, :provided_by_gcp) }
let(:service) { cluster.platform_kubernetes }
@@ -166,6 +195,7 @@ describe Clusters::Applications::Knative do
before do
stub_kubeclient_discover(service.api_url)
stub_kubeclient_knative_services
+ stub_kubeclient_service_pods
end
it 'should have an unintialized cache' do
@@ -174,7 +204,11 @@ describe Clusters::Applications::Knative do
context 'when using synchronous reactive cache' do
before do
- stub_reactive_cache(knative, services: kube_response(kube_knative_services_body))
+ stub_reactive_cache(knative,
+ {
+ services: kube_response(kube_knative_services_body),
+ pods: kube_response(kube_knative_pods_body(cluster.cluster_project.project.name, namespace.namespace))
+ })
synchronous_reactive_cache(knative)
end