From 8537bb5c42177caeecfa622a35e798b864441fc4 Mon Sep 17 00:00:00 2001 From: Sebastien Plisson Date: Tue, 27 Feb 2018 14:08:51 -0800 Subject: [PATCH] Added test cases for chart present under charts folder Signed-off-by: Sebastien Plisson --- pkg/downloader/manager_test.go | 7 +++++ .../testdata/local-subchart/Chart.yaml | 3 +++ pkg/resolver/resolver_test.go | 27 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 pkg/downloader/testdata/local-subchart/Chart.yaml diff --git a/pkg/downloader/manager_test.go b/pkg/downloader/manager_test.go index ef8b95071..232c0a882 100644 --- a/pkg/downloader/manager_test.go +++ b/pkg/downloader/manager_test.go @@ -156,6 +156,13 @@ func TestGetRepoNames(t *testing.T) { }, expect: map[string]string{"oedipus-rex": "testing"}, }, + { + name: "repo from local chart under charts path", + req: []*chartutil.Dependency{ + {Name: "local-subchart", Repository: ""}, + }, + expect: map[string]string{}, + }, } for _, tt := range tests { diff --git a/pkg/downloader/testdata/local-subchart/Chart.yaml b/pkg/downloader/testdata/local-subchart/Chart.yaml new file mode 100644 index 000000000..1e17203e5 --- /dev/null +++ b/pkg/downloader/testdata/local-subchart/Chart.yaml @@ -0,0 +1,3 @@ +description: A Helm chart for Kubernetes +name: local-subchart +version: 0.1.0 diff --git a/pkg/resolver/resolver_test.go b/pkg/resolver/resolver_test.go index f35e051fa..567eb46d4 100644 --- a/pkg/resolver/resolver_test.go +++ b/pkg/resolver/resolver_test.go @@ -90,6 +90,33 @@ func TestResolve(t *testing.T) { }, err: true, }, + { + name: "repo from valid path under charts path", + req: &chartutil.Requirements{ + Dependencies: []*chartutil.Dependency{ + {Name: "localdependency", Repository: "", Version: "0.1.0"}, + }, + }, + expect: &chartutil.RequirementsLock{ + Dependencies: []*chartutil.Dependency{ + {Name: "localdependency", Repository: "", Version: "0.1.0"}, + }, + }, + }, + { + name: "repo from valid path under charts path", + req: &chartutil.Requirements{ + Dependencies: []*chartutil.Dependency{ + {Name: "inexistentdependency", Repository: "", Version: "0.1.0"}, + }, + }, + expect: &chartutil.RequirementsLock{ + Dependencies: []*chartutil.Dependency{ + {Name: "inexistentlocaldependency", Repository: "", Version: "0.1.0"}, + }, + }, + err: true, + }, } repoNames := map[string]string{"alpine": "kubernetes-charts", "redis": "kubernetes-charts"}