mirror of
https://github.com/helmfile/helmfile.git
synced 2026-09-30 08:32:48 +02:00
fix unittest issue for context.go
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user