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
100dd3b0
Commit
100dd3b0
authored
Mar 29, 2016
by
jackgr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add chart content test
parent
cbe756cb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
chart_test.go
pkg/chart/chart_test.go
+35
-0
No files found.
pkg/chart/chart_test.go
View file @
100dd3b0
...
...
@@ -21,9 +21,11 @@ import (
"fmt"
"io/ioutil"
"path/filepath"
"reflect"
"testing"
"github.com/kubernetes/helm/pkg/log"
"github.com/kubernetes/helm/pkg/util"
)
const
(
...
...
@@ -238,6 +240,39 @@ func TestLoadMember(t *testing.T) {
}
}
func
TestLoadContent
(
t
*
testing
.
T
)
{
c
,
err
:=
LoadDir
(
testdir
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to load chart: %s"
,
err
)
}
content
,
err
:=
c
.
LoadContent
()
if
err
!=
nil
{
t
.
Errorf
(
"Failed to load chart content: %s"
,
err
)
}
want
:=
c
.
Chartfile
()
have
:=
content
.
Chartfile
if
!
reflect
.
DeepEqual
(
want
,
have
)
{
t
.
Errorf
(
"Unexpected chart file
\n
want:
\n
%s
\n
have:
\n
%s
\n
"
,
util
.
ToYAMLOrError
(
want
),
util
.
ToYAMLOrError
(
have
))
}
for
_
,
member
:=
range
content
.
Members
{
have
:=
member
.
Content
wantMember
,
err
:=
c
.
LoadMember
(
member
.
Path
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to load chart member: %s"
,
err
)
}
t
.
Logf
(
"%s:
\n
%s
\n\n
"
,
member
.
Path
,
member
.
Content
)
want
:=
wantMember
.
Content
if
!
reflect
.
DeepEqual
(
want
,
have
)
{
t
.
Errorf
(
"Unexpected chart member %s
\n
want:
\n
%s
\n
have:
\n
%s
\n
"
,
member
.
Path
,
want
,
have
)
}
}
}
func
compareContent
(
filename
,
content
string
)
error
{
b
,
err
:=
ioutil
.
ReadFile
(
filename
)
if
err
!=
nil
{
...
...
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