diff --git a/internal/internal_test.go b/internal/internal_test.go index aafc1929a..5be5b08d2 100644 --- a/internal/internal_test.go +++ b/internal/internal_test.go @@ -40,6 +40,7 @@ func TestSnakeCase(t *testing.T) { var ( sleepbin, _ = exec.LookPath("sleep") echobin, _ = exec.LookPath("echo") + shell, _ = exec.LookPath("sh") ) func TestRunTimeout(t *testing.T) { @@ -84,13 +85,13 @@ func TestCombinedOutput(t *testing.T) { // test that CombinedOutputTimeout and exec.Cmd.CombinedOutput return // the same output from a failed command. func TestCombinedOutputError(t *testing.T) { - if sleepbin == "" { - t.Skip("'sleep' binary not available on OS, skipping.") + if shell == "" { + t.Skip("'sh' binary not available on OS, skipping.") } - cmd := exec.Command(sleepbin, "foo") + cmd := exec.Command(shell, "-c", "false") expected, err := cmd.CombinedOutput() - cmd2 := exec.Command(sleepbin, "foo") + cmd2 := exec.Command(shell, "-c", "false") actual, err := CombinedOutputTimeout(cmd2, time.Second) assert.Error(t, err) @@ -98,10 +99,10 @@ func TestCombinedOutputError(t *testing.T) { } func TestRunError(t *testing.T) { - if sleepbin == "" { - t.Skip("'sleep' binary not available on OS, skipping.") + if shell == "" { + t.Skip("'sh' binary not available on OS, skipping.") } - cmd := exec.Command(sleepbin, "foo") + cmd := exec.Command(shell, "-c", "false") err := RunTimeout(cmd, time.Second) assert.Error(t, err)