From eeb2eee09959a3bfe0702897aa100794109223d6 Mon Sep 17 00:00:00 2001 From: yxxhero Date: Wed, 27 Apr 2022 10:56:05 +0800 Subject: [PATCH] fix unittest issue for context.go Signed-off-by: yxxhero --- pkg/helmexec/context_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/helmexec/context_test.go b/pkg/helmexec/context_test.go index 60c5421d..d901def7 100644 --- a/pkg/helmexec/context_test.go +++ b/pkg/helmexec/context_test.go @@ -2,6 +2,7 @@ package helmexec import ( "os" + "path/filepath" "testing" "github.com/Masterminds/semver/v3" @@ -55,6 +56,11 @@ func TestGetTillerlessArgs(t *testing.T) { } } +func pwd() string { + pwd, _ := os.Getwd() + return pwd +} + // TestGetTillerlessEnv tests the getTillerlessEnv function func TestGetTillerlessEnv(t *testing.T) { kubeconfigEnv := "KUBECONFIG" @@ -72,7 +78,7 @@ func TestGetTillerlessEnv(t *testing.T) { { tillerless: true, kubeconfig: "abc", - expected: map[string]string{"HELM_TILLER_SILENT": "true", kubeconfigEnv: "/workdir/helmfile/pkg/helmexec/abc"}, + expected: map[string]string{"HELM_TILLER_SILENT": "true", kubeconfigEnv: filepath.Join(pwd(), "abc")}, }, { tillerless: true,