From 335c1138497d504f97a720c17d3459011ed219a1 Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg Date: Mon, 7 Aug 2023 10:25:49 -0700 Subject: [PATCH] some feedback Signed-off-by: Ludvig Liljenberg --- pkg/exec/builder/execute_test.go | 14 +++++++++----- pkg/test/helper.go | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/exec/builder/execute_test.go b/pkg/exec/builder/execute_test.go index b5c57261c6..a82c8d9d84 100644 --- a/pkg/exec/builder/execute_test.go +++ b/pkg/exec/builder/execute_test.go @@ -2,7 +2,6 @@ package builder import ( "context" - "fmt" "os" "path/filepath" "runtime" @@ -145,9 +144,9 @@ func TestExecuteStep_HasOrderedArguments(t *testing.T) { } func TestExecuteStep_SpecifiesCustomWorkingDirectory(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip() // pwd not available on windows (for some reason the only command that works is "help" ?!?) - } + //if runtime.GOOS == "windows" { + // t.Skip() // pwd not available on windows (for some reason the only command that works is "help" ?!?) + //} ctx := context.Background() c := porterruntime.NewTestRuntimeConfig(t) @@ -163,8 +162,13 @@ func TestExecuteStep_SpecifiesCustomWorkingDirectory(t *testing.T) { SuffixArguments: []string{}, } + if runtime.GOOS == "windows" { + step.TestStep.Command = "cmd.exe" + step.Arguments = []string{"/c", "cd"} + } + _, err := ExecuteStep(ctx, c.RuntimeConfig, step) - assert.Equal(t, fmt.Sprintln(wd), c.TestContext.GetOutput()) + assert.Equal(t, wd, strings.TrimRight(c.TestContext.GetOutput(), "\r\n")) require.NoError(t, err, "Execute Step failed") } diff --git a/pkg/test/helper.go b/pkg/test/helper.go index 4e6fa57897..947f4c3014 100644 --- a/pkg/test/helper.go +++ b/pkg/test/helper.go @@ -31,7 +31,7 @@ func TestMainWithMockedCommandHandlers(m *testing.M) { // There may be multiple expected commands, separated by a newline character wantCmds := strings.Split(expectedCmdEnv, "\n") - + commandNotFound := true for _, wantCmd := range wantCmds { if wantCmd == gotCmd {