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
4ef61a71
Commit
4ef61a71
authored
Jun 29, 2016
by
Adnan Abdulhussein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(chartutil): Ensure ReadValues doesn't return a nil map
parent
da2f7e96
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
values.go
pkg/chartutil/values.go
+3
-3
values_test.go
pkg/chartutil/values_test.go
+12
-0
No files found.
pkg/chartutil/values.go
View file @
4ef61a71
...
...
@@ -110,9 +110,9 @@ func tableLookup(v Values, simple string) (Values, error) {
// ReadValues will parse YAML byte data into a Values.
func
ReadValues
(
data
[]
byte
)
(
vals
Values
,
err
error
)
{
vals
=
make
(
map
[
string
]
interface
{}
)
if
len
(
data
)
>
0
{
err
=
yaml
.
Unmarshal
(
data
,
&
vals
)
err
=
yaml
.
Unmarshal
(
data
,
&
vals
)
if
len
(
vals
)
==
0
{
vals
=
Values
{}
}
return
}
...
...
pkg/chartutil/values_test.go
View file @
4ef61a71
...
...
@@ -53,6 +53,18 @@ water:
t
.
Fatalf
(
"Error parsing bytes: %s"
,
err
)
}
matchValues
(
t
,
data
)
tests
:=
[]
string
{
`poet: "Coleridge"`
,
"# Just a comment"
,
""
}
for
_
,
tt
:=
range
tests
{
data
,
err
=
ReadValues
([]
byte
(
tt
))
if
err
!=
nil
{
t
.
Fatalf
(
"Error parsing bytes: %s"
,
err
)
}
if
data
==
nil
{
t
.
Errorf
(
`YAML string "%s" gave a nil map`
,
tt
)
}
}
}
func
TestReadValuesFile
(
t
*
testing
.
T
)
{
...
...
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