From 6de70254fd37e028e31ba9a5c84647eef9df7960 Mon Sep 17 00:00:00 2001 From: Mitchel Humpherys Date: Tue, 12 Dec 2017 22:09:40 -0800 Subject: [PATCH] feat(repo): Add test for non-existent repo path --- pkg/repo/repo_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/repo/repo_test.go b/pkg/repo/repo_test.go index 6aee41faf..4b5bcdbf5 100644 --- a/pkg/repo/repo_test.go +++ b/pkg/repo/repo_test.go @@ -19,6 +19,7 @@ package repo import "testing" import "io/ioutil" import "os" +import "strings" const testRepositoriesFile = "testdata/repositories.yaml" @@ -215,3 +216,12 @@ func TestWriteFile(t *testing.T) { } } } + +func TestRepoNotExists(t *testing.T) { + _, err := LoadRepositoriesFile("/this/path/does/not/exist.yaml") + if err == nil { + t.Errorf("expected err to be non-nil when path does not exist") + } else if !strings.Contains(err.Error(), "You might need to run `helm init`") { + t.Errorf("expected prompt to run `helm init` when repositories file does not exist") + } +}