|
|
|
@ -19,6 +19,8 @@ import (
|
|
|
|
|
"bytes"
|
|
|
|
|
"fmt"
|
|
|
|
|
"io"
|
|
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
@ -50,6 +52,25 @@ func TestUpdateCmd(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestUpdateCustomCacheCmd(t *testing.T) {
|
|
|
|
|
var out bytes.Buffer
|
|
|
|
|
rootDir := ensure.TempDir(t)
|
|
|
|
|
cachePath := filepath.Join(rootDir, "updcustomcache")
|
|
|
|
|
_ = os.Mkdir(cachePath, os.ModePerm)
|
|
|
|
|
defer os.RemoveAll(cachePath)
|
|
|
|
|
o := &repoUpdateOptions{
|
|
|
|
|
update: updateCharts,
|
|
|
|
|
repoFile: "testdata/repositories.yaml",
|
|
|
|
|
repoCache: cachePath,
|
|
|
|
|
}
|
|
|
|
|
if err := o.run(&out); err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
if _, err := os.Stat(filepath.Join(cachePath, "charts-index.yaml")); err != nil {
|
|
|
|
|
t.Fatalf("error finding created index file in custom cache: %#v", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestUpdateCharts(t *testing.T) {
|
|
|
|
|
defer resetEnv()()
|
|
|
|
|
defer ensure.HelmHome(t)()
|
|
|
|
|