From 0ecef707153254fa1f85d4f30f4d7864191012f9 Mon Sep 17 00:00:00 2001 From: Danielle Tomlinson Date: Fri, 11 Jan 2019 16:49:53 +0000 Subject: [PATCH] rawexec: Fix Exec test on windows --- drivers/rawexec/driver_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/rawexec/driver_test.go b/drivers/rawexec/driver_test.go index d07583131..31c25e085 100644 --- a/drivers/rawexec/driver_test.go +++ b/drivers/rawexec/driver_test.go @@ -417,13 +417,13 @@ func TestRawExecDriver_Exec(t *testing.T) { if runtime.GOOS == "windows" { // Exec a command that should work - res, err := harness.ExecTask(task.ID, []string{"echo", "hello"}, 1*time.Second) + res, err := harness.ExecTask(task.ID, []string{"cmd.exe", "/c", "echo", "hello"}, 1*time.Second) require.NoError(err) require.True(res.ExitResult.Successful()) - require.True(len(res.Stdout) > 100) + require.Equal(string(res.Stdout), "hello\r\n") // Exec a command that should fail - res, err = harness.ExecTask(task.ID, []string{"stat", "notarealfile123abc"}, 1*time.Second) + res, err = harness.ExecTask(task.ID, []string{"cmd.exe", "/c", "stat", "notarealfile123abc"}, 1*time.Second) require.NoError(err) require.False(res.ExitResult.Successful()) require.Contains(string(res.Stdout), "not recognized")