From df0daca132e36da0d824feef9d2fc733150a56cd Mon Sep 17 00:00:00 2001 From: Lucas Fernando Cardoso Nunes Date: Fri, 15 Dec 2023 11:47:49 -0300 Subject: [PATCH] fix: Signed-off-by: Lucas Fernando Cardoso Nunes --- pkg/providers/k8s/k8s_test.go | 11 +++++++---- vals.go | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/providers/k8s/k8s_test.go b/pkg/providers/k8s/k8s_test.go index eb1fb5d8..5871553e 100644 --- a/pkg/providers/k8s/k8s_test.go +++ b/pkg/providers/k8s/k8s_test.go @@ -84,7 +84,7 @@ func Test_getObject(t *testing.T) { } } -func Test_getKubeConfig(t *testing.T) { +func Test_getKubeConfigPath(t *testing.T) { homeDir, _ := os.UserHomeDir() testcases := []struct { config config.MapConfig @@ -146,7 +146,7 @@ func Test_getKubeConfig(t *testing.T) { if tc.kubeConfigEnvVar != "" { os.Setenv("KUBECONFIG", tc.kubeConfigEnvVar) } - got, err := getKubeConfig(tc.config) + got, err := getKubeConfigPath(tc.config) if err != nil { if err.Error() != tc.wantErr { t.Fatalf("unexpected error: want %q, got %q", tc.wantErr, err.Error()) @@ -190,7 +190,10 @@ func Test_getKubeContext(t *testing.T) { for i := range testcases { tc := testcases[i] t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { - got := getKubeContext(tc.config) + got, err := getKubeContext(tc.config) + if err != nil { + t.Fatalf("unexpected error: %s", err) + } if diff := cmp.Diff(tc.want, got); diff != "" { t.Errorf("unexpected result: -(want), +(got)\n%s", diff) } @@ -261,7 +264,7 @@ func Test_GetString(t *testing.T) { conf := map[string]interface{}{} conf["kubeConfigPath"] = fmt.Sprintf("%s/.kube/config", homeDir) conf["kubeContext"] = "minikube" - p, _ := New(logger, config.MapConfig{M: conf}) + p := New(logger, config.MapConfig{M: conf}) got, err := p.GetString(tc.path) if err != nil { diff --git a/vals.go b/vals.go index efb07195..c5b4f2df 100644 --- a/vals.go +++ b/vals.go @@ -252,7 +252,7 @@ func (r *Runtime) prepare() (*expansion.ExpandRegexMatch, error) { return p, nil case ProviderK8s: p := k8s.New(r.logger, conf) - return p, nil + return p, nil } return nil, fmt.Errorf("no provider registered for scheme %q", scheme) }