diff --git a/cmd/helm/init_test.go b/cmd/helm/init_test.go index fd6ef97c4..7c9deb044 100644 --- a/cmd/helm/init_test.go +++ b/cmd/helm/init_test.go @@ -39,6 +39,7 @@ import ( "k8s.io/helm/cmd/helm/installer" "k8s.io/helm/pkg/helm/helmpath" + "k8s.io/helm/pkg/repo" ) func TestInitCmd(t *testing.T) { @@ -202,6 +203,35 @@ func TestEnsureHome(t *testing.T) { t.Error(err) } + rr, err := repo.LoadRepositoriesFile(hh.RepositoryFile()) + if err != nil { + t.Error(err) + } + + foundStable := false + for _, rr := range rr.Repositories { + if rr.Name == stableRepository { + foundStable = true + if err != nil { + t.Error(err) + } + if !filepath.IsAbs(rr.Cache) { + t.Errorf("%s stable repo cache path is an absolute path", rr.Cache) + } + absCache, err := filepath.Abs(filepath.Join(hh.Cache(), rr.Cache)) + if err != nil { + t.Error(err) + } + if absCache != hh.CacheIndex(stableRepository) { + t.Errorf("%s stable repo cache path doesn't resolve to absolute cache index path", rr.Cache) + } + break + } + } + if !foundStable { + t.Errorf("stable repo not found") + } + expectedDirs := []string{hh.String(), hh.Repository(), hh.Cache(), hh.LocalRepository()} for _, dir := range expectedDirs { if fi, err := os.Stat(dir); err != nil {