|
|
|
@ -19,6 +19,7 @@ package chartutil
|
|
|
|
|
import (
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"os"
|
|
|
|
|
"path"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
@ -34,6 +35,8 @@ func TestSave(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
defer os.RemoveAll(tmp)
|
|
|
|
|
|
|
|
|
|
for _, dest := range []string{tmp, path.Join(tmp, "newdir")} {
|
|
|
|
|
t.Run("outDir="+dest, func(t *testing.T) {
|
|
|
|
|
c := &chart.Chart{
|
|
|
|
|
Metadata: &chart.Metadata{
|
|
|
|
|
APIVersion: chart.APIVersionV1,
|
|
|
|
@ -45,12 +48,12 @@ func TestSave(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
where, err := Save(c, tmp)
|
|
|
|
|
where, err := Save(c, dest)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("Failed to save: %s", err)
|
|
|
|
|
}
|
|
|
|
|
if !strings.HasPrefix(where, tmp) {
|
|
|
|
|
t.Fatalf("Expected %q to start with %q", where, tmp)
|
|
|
|
|
if !strings.HasPrefix(where, dest) {
|
|
|
|
|
t.Fatalf("Expected %q to start with %q", where, dest)
|
|
|
|
|
}
|
|
|
|
|
if !strings.HasSuffix(where, ".tgz") {
|
|
|
|
|
t.Fatalf("Expected %q to end with .tgz", where)
|
|
|
|
@ -66,6 +69,8 @@ func TestSave(t *testing.T) {
|
|
|
|
|
if len(c2.Files) != 1 || c2.Files[0].Name != "scheherazade/shahryar.txt" {
|
|
|
|
|
t.Fatal("Files data did not match")
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestSaveDir(t *testing.T) {
|
|
|
|
|