Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
fb1dd48b
Commit
fb1dd48b
authored
Apr 11, 2018
by
Chance Zibolski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test helm template -x with non-existent manifest
parent
b9adc356
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
template_test.go
cmd/helm/template_test.go
+22
-2
No files found.
cmd/helm/template_test.go
View file @
fb1dd48b
...
...
@@ -43,6 +43,7 @@ func TestTemplateCmd(t *testing.T) {
args
[]
string
expectKey
string
expectValue
string
expectError
string
}{
{
name
:
"check_name"
,
...
...
@@ -65,6 +66,12 @@ func TestTemplateCmd(t *testing.T) {
expectKey
:
"subchart1/templates/service.yaml"
,
expectValue
:
"protocol: TCP
\n
name: apache"
,
},
{
name
:
"check_execute_non_existent"
,
desc
:
"verify --execute fails on a template that doesnt exist"
,
args
:
[]
string
{
subchart1ChartPath
,
"-x"
,
"templates/thisdoesntexist.yaml"
},
expectError
:
"could not find template"
,
},
{
name
:
"check_execute_absolute"
,
desc
:
"verify --execute single template"
,
...
...
@@ -143,8 +150,21 @@ func TestTemplateCmd(t *testing.T) {
cmd
:=
newTemplateCmd
(
out
)
cmd
.
SetArgs
(
tt
.
args
)
err
:=
cmd
.
Execute
()
if
err
!=
nil
{
t
.
Errorf
(
"expected: %v, got %v"
,
tt
.
expectValue
,
err
)
if
tt
.
expectError
!=
""
{
if
err
==
nil
{
t
.
Errorf
(
"expected err: %s, but no error occurred"
,
tt
.
expectError
)
}
// non nil error, check if it contains the expected error
if
strings
.
Contains
(
err
.
Error
(),
tt
.
expectError
)
{
// had the error we were looking for, this test case is
// done
return
}
else
{
t
.
Fatalf
(
"expected err: %q, got: %q"
,
tt
.
expectError
,
err
)
}
}
else
if
err
!=
nil
{
t
.
Errorf
(
"expected no error, got %v"
,
err
)
}
// restore stdout
w
.
Close
()
...
...
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