summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2019-02-26 18:14:00 +0100
committerRémy Coutable <remy@rymai.me>2019-03-07 08:13:37 +0100
commitbe44024c51f54c51b2729e5a19ae85a12ace2c17 (patch)
treefc4187c2c18bb3501b7c62f83e1e1fef953e06df /spec/support
parentf5e80ed6b24f5aacda2868a836ffe7b741cb422d (diff)
downloadgitlab-ce-be44024c51f54c51b2729e5a19ae85a12ace2c17.tar.gz
Reduce differences in spec/support/helpers/kubernetes_helpers.rb
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers/kubernetes_helpers.rb15
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",