|
|
|
@ -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\nwant:\n%s\nhave:\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\nwant:\n%s\nhave:\n%s\n", member.Path, want, have)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func compareContent(filename, content string) error {
|
|
|
|
|
b, err := ioutil.ReadFile(filename)
|
|
|
|
|
if err != nil {
|
|
|
|
|