Commit be44024c authored by Rémy Coutable's avatar Rémy Coutable

Reduce differences in spec/support/helpers/kubernetes_helpers.rb

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent f5e80ed6
...@@ -9,6 +9,10 @@ module KubernetesHelpers ...@@ -9,6 +9,10 @@ module KubernetesHelpers
kube_response(kube_pods_body) kube_response(kube_pods_body)
end end
def kube_logs_response
kube_response(kube_logs_body)
end
def kube_deployments_response def kube_deployments_response
kube_response(kube_deployments_body) kube_response(kube_deployments_body)
end end
...@@ -34,6 +38,13 @@ module KubernetesHelpers ...@@ -34,6 +38,13 @@ module KubernetesHelpers
WebMock.stub_request(:get, pods_url).to_return(response || kube_pods_response) WebMock.stub_request(:get, pods_url).to_return(response || kube_pods_response)
end end
def stub_kubeclient_logs(pod_name, response = nil)
stub_kubeclient_discover(service.api_url)
logs_url = service.api_url + "/api/v1/namespaces/#{service.actual_namespace}/pods/#{pod_name}/log?tailLines=#{Clusters::Platforms::Kubernetes::LOGS_LIMIT}"
WebMock.stub_request(:get, logs_url).to_return(response || kube_logs_response)
end
def stub_kubeclient_deployments(response = nil) def stub_kubeclient_deployments(response = nil)
stub_kubeclient_discover(service.api_url) stub_kubeclient_discover(service.api_url)
deployments_url = service.api_url + "/apis/extensions/v1beta1/namespaces/#{service.actual_namespace}/deployments" deployments_url = service.api_url + "/apis/extensions/v1beta1/namespaces/#{service.actual_namespace}/deployments"
...@@ -212,6 +223,10 @@ module KubernetesHelpers ...@@ -212,6 +223,10 @@ module KubernetesHelpers
} }
end end
def kube_logs_body
"Log 1\nLog 2\nLog 3"
end
def kube_deployments_body def kube_deployments_body
{ {
"kind" => "DeploymentList", "kind" => "DeploymentList",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment