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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
6a6c0f05
Commit
6a6c0f05
authored
Sep 19, 2018
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify the KubernetesClient spec
Only verify the arguments we actually care about.
parent
f205d099
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
20 deletions
+14
-20
spec/lib/quality/kubernetes_client_spec.rb
spec/lib/quality/kubernetes_client_spec.rb
+14
-20
No files found.
spec/lib/quality/kubernetes_client_spec.rb
View file @
6a6c0f05
...
@@ -3,29 +3,23 @@
...
@@ -3,29 +3,23 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
Quality
::
KubernetesClient
do
RSpec
.
describe
Quality
::
KubernetesClient
do
let
(
:namespace
)
{
'review-apps-ee'
}
subject
{
described_class
.
new
(
namespace:
'review-apps-ee'
)
}
let
(
:release_name
)
{
'my-release'
}
subject
{
described_class
.
new
(
namespace:
namespace
)
}
describe
'#cleanup'
do
describe
'#cleanup'
do
it
'calls helm list with default arguments'
do
it
'calls kubectl with the correct arguments'
do
expect
(
Gitlab
::
Popen
).
to
receive
(
:popen_with_detail
)
# popen_with_detail will receive an array with a bunch of arguments; we're
.
with
([
# only concerned with it having the correct namespace and release name
%(kubectl)
,
expect
(
Gitlab
::
Popen
).
to
receive
(
:popen_with_detail
)
do
|
args
|
%(-n "#{namespace}" get ingress,svc,pdb,hpa,deploy,statefulset,job,pod,secret,configmap,pvc,secret,clusterrole,clusterrolebinding,role,rolebinding,sa 2>&1)
,
expect
(
args
)
'|'
,
.
to
satisfy_one
{
|
arg
|
arg
.
start_with?
(
'-n "review-apps-ee" get'
)
}
%(grep "#{release_name}")
,
expect
(
args
)
'|'
,
.
to
satisfy_one
{
|
arg
|
arg
==
'grep "my-release"'
}
"awk '{print $1}'"
,
expect
(
args
)
'|'
,
.
to
satisfy_one
{
|
arg
|
arg
.
end_with?
(
'-n "review-apps-ee" delete'
)
}
%(xargs kubectl -n "#{namespace}" delete)
,
end
'||'
,
'true'
])
.
and_return
(
Gitlab
::
Popen
::
Result
.
new
([],
''
))
subject
.
cleanup
(
release_name:
release_name
)
# We're not verifying the output here, just silencing it
expect
{
subject
.
cleanup
(
release_name:
'my-release'
)
}.
to
output
.
to_stdout
end
end
end
end
end
end
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