diff --git a/test/cmd/command.go b/test/cmd/command.go index c7b05440d..1fa2c3725 100644 --- a/test/cmd/command.go +++ b/test/cmd/command.go @@ -29,8 +29,8 @@ import ( const ( invalidInputErrorPrefix = "invalid input: " - defaultErrCode = 1 - separator = "\n" + defaultErrCode = 1 + separator = "\n" ) // RunCommand will run the command and return the standard output, plus error if there is one. @@ -38,9 +38,9 @@ func RunCommand(cmdLine string) (string, error) { cmdSplit, err := shell.Split(cmdLine) if len(cmdSplit) == 0 || err != nil { return "", &CommandLineError{ - Command: cmdLine, + Command: cmdLine, ErrorOutput: []byte(invalidInputErrorPrefix + cmdLine), - ErrorCode: defaultErrCode, + ErrorCode: defaultErrCode, } } @@ -53,9 +53,9 @@ func RunCommand(cmdLine string) (string, error) { out, err := cmd.Output() if err != nil { return string(out), &CommandLineError{ - Command: cmdLine, + Command: cmdLine, ErrorOutput: eb.Bytes(), - ErrorCode: getErrorCode(err), + ErrorCode: getErrorCode(err), } } diff --git a/test/cmd/command_test.go b/test/cmd/command_test.go index 80c13717b..587aa0640 100644 --- a/test/cmd/command_test.go +++ b/test/cmd/command_test.go @@ -23,10 +23,10 @@ import ( func TestRunCommand(t *testing.T) { testCases := []struct { - command string - expectedOutput string + command string + expectedOutput string expectedErrorOutput string - expectedErrorCode int + expectedErrorCode int }{ {"", "", invalidInputErrorPrefix + "", 1}, {" ", "", invalidInputErrorPrefix + " ", 1}, @@ -62,10 +62,10 @@ func TestRunCommand(t *testing.T) { func TestRunCommands(t *testing.T) { testCases := []struct { - commands []string - expectedOutput string + commands []string + expectedOutput string expectedErrorOutput string - expectedErrorCode int + expectedErrorCode int }{ { []string{"echo 123", "echo 234", "echo 345"}, @@ -127,8 +127,8 @@ func TestRunCommands(t *testing.T) { func TestRunCommandsInParallel(t *testing.T) { testCases := []struct { - commands []string - possibleOutput []string + commands []string + possibleOutput []string possibleErrorOutput []string }{ { @@ -151,7 +151,7 @@ func TestRunCommandsInParallel(t *testing.T) { out, err := RunCommandsInParallel(c.commands...) idx := -1 - for i := range c.possibleOutput { + for i := range c.possibleOutput { if c.possibleOutput[i] == out { idx = i break