diff options
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/helpers/kubernetes_helpers.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/support/helpers/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb index 9dc89b483b2..cca11e112c9 100644 --- a/spec/support/helpers/kubernetes_helpers.rb +++ b/spec/support/helpers/kubernetes_helpers.rb @@ -9,6 +9,10 @@ module KubernetesHelpers kube_response(kube_pods_body) end + def kube_logs_response + kube_response(kube_logs_body) + end + def kube_deployments_response kube_response(kube_deployments_body) end @@ -34,6 +38,13 @@ module KubernetesHelpers WebMock.stub_request(:get, pods_url).to_return(response || kube_pods_response) 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) stub_kubeclient_discover(service.api_url) deployments_url = service.api_url + "/apis/extensions/v1beta1/namespaces/#{service.actual_namespace}/deployments" @@ -212,6 +223,10 @@ module KubernetesHelpers } end + def kube_logs_body + "Log 1\nLog 2\nLog 3" + end + def kube_deployments_body { "kind" => "DeploymentList", |