From b2f78726956ba79c0dfde538fa604c6a8e709a75 Mon Sep 17 00:00:00 2001 From: yxxhero Date: Sun, 16 Nov 2025 10:05:27 +0800 Subject: [PATCH] update tests Signed-off-by: yxxhero (cherry picked from commit 8c870248602e231be274b68b4cfd0f4b8387aa53) --- internal/plugin/subprocess_commands_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/plugin/subprocess_commands_test.go b/internal/plugin/subprocess_commands_test.go index a916a176f..8e9c1663e 100644 --- a/internal/plugin/subprocess_commands_test.go +++ b/internal/plugin/subprocess_commands_test.go @@ -16,7 +16,6 @@ limitations under the License. package plugin import ( - "os" "reflect" "runtime" "testing" @@ -225,7 +224,6 @@ func TestPrepareCommandsNoCommands(t *testing.T) { } func TestPrepareCommandsExpand(t *testing.T) { - t.Setenv("TESTX", "testx") cmdMain := "sh" cmdArgs := []string{"-c", "echo \"${TESTX}${TESTY}\""} cmds := []PlatformCommand{ @@ -234,8 +232,10 @@ func TestPrepareCommandsExpand(t *testing.T) { expectedArgs := []string{"-c", "echo \"testxtesty\""} - env := parseEnv(os.Environ()) - env["TESTY"] = "testy" + env := map[string]string{ + "TESTX": "testx", + "TESTY": "testy", + } cmd, args, err := PrepareCommands(cmds, true, []string{}, env) if err != nil { @@ -250,13 +250,15 @@ func TestPrepareCommandsExpand(t *testing.T) { } func TestPrepareCommandsNoExpand(t *testing.T) { - t.Setenv("TEST", "test") cmdMain := "sh" cmdArgs := []string{"-c", "echo \"${TEST}\""} cmds := []PlatformCommand{ {OperatingSystem: "", Architecture: "", Command: cmdMain, Args: cmdArgs}, } - env := parseEnv(os.Environ()) + + env := map[string]string{ + "TEST": "test", + } cmd, args, err := PrepareCommands(cmds, false, []string{}, env) if err != nil {