Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
be44024c
Commit
be44024c
authored
Feb 26, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce differences in spec/support/helpers/kubernetes_helpers.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
f5e80ed6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
spec/support/helpers/kubernetes_helpers.rb
spec/support/helpers/kubernetes_helpers.rb
+15
-0
No files found.
spec/support/helpers/kubernetes_helpers.rb
View file @
be44024c
...
@@ -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
\n
Log 2
\n
Log 3"
end
def
kube_deployments_body
def
kube_deployments_body
{
{
"kind"
=>
"DeploymentList"
,
"kind"
=>
"DeploymentList"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment