diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-08-26 11:46:20 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-08-26 11:46:20 +0200 |
commit | fee0f6489a6aa734e008b10ef275e464e66bfc17 (patch) | |
tree | 80bc9272a7b09d22f762c392130608c872246126 /client/go/cmd/command_tester.go | |
parent | 58224ccdae4531dac1b0634d27cf894a6a61a779 (diff) |
Cleanup printing and colorization
Diffstat (limited to 'client/go/cmd/command_tester.go')
-rw-r--r-- | client/go/cmd/command_tester.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/client/go/cmd/command_tester.go b/client/go/cmd/command_tester.go index 50684d87a1b..6078167df40 100644 --- a/client/go/cmd/command_tester.go +++ b/client/go/cmd/command_tester.go @@ -6,25 +6,27 @@ package cmd import ( "bytes" - "github.com/stretchr/testify/assert" - "github.com/vespa-engine/vespa/util" "io/ioutil" + "log" "net/http" "strconv" "testing" "time" + + "github.com/stretchr/testify/assert" + "github.com/vespa-engine/vespa/util" ) func executeCommand(t *testing.T, client *mockHttpClient, args []string, moreArgs []string) (standardout string) { util.ActiveHttpClient = client // Reset - persistent flags in Cobra persists over tests - util.Out = bytes.NewBufferString("") + log.SetOutput(bytes.NewBufferString("")) rootCmd.SetArgs([]string{"status", "-t", ""}) rootCmd.Execute() b := bytes.NewBufferString("") - util.Out = b + log.SetOutput(b) rootCmd.SetArgs(append(args, moreArgs...)) rootCmd.Execute() out, err := ioutil.ReadAll(b) |