Skip to content

Commit 6de7025

Browse files
committed
feat(repo): Add test for non-existent repo path
1 parent 7417f09 commit 6de7025

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/repo/repo_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package repo
1919
import "testing"
2020
import "io/ioutil"
2121
import "os"
22+
import "strings"
2223

2324
const testRepositoriesFile = "testdata/repositories.yaml"
2425

@@ -215,3 +216,12 @@ func TestWriteFile(t *testing.T) {
215216
}
216217
}
217218
}
219+
220+
func TestRepoNotExists(t *testing.T) {
221+
_, err := LoadRepositoriesFile("/this/path/does/not/exist.yaml")
222+
if err == nil {
223+
t.Errorf("expected err to be non-nil when path does not exist")
224+
} else if !strings.Contains(err.Error(), "You might need to run `helm init`") {
225+
t.Errorf("expected prompt to run `helm init` when repositories file does not exist")
226+
}
227+
}

0 commit comments

Comments
 (0)