Skip to content

Commit

Permalink
when in tests, send cobra help and errors to discard
Browse files Browse the repository at this point in the history
Signed-off-by: Avi Deitcher <[email protected]>
  • Loading branch information
deitch committed May 2, 2024
1 parent 9c90a2c commit f296491
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/dump_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"io"
"net/url"
"testing"

Expand Down Expand Up @@ -140,6 +141,7 @@ func TestDumpCmd(t *testing.T) {
if err != nil {
t.Fatal(err)
}
cmd.SetOutput(io.Discard)
cmd.SetArgs(append([]string{"dump"}, tt.args...))
err = cmd.Execute()
switch {
Expand Down
2 changes: 2 additions & 0 deletions cmd/prune_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"io"
"net/url"
"testing"

Expand Down Expand Up @@ -43,6 +44,7 @@ func TestPruneCmd(t *testing.T) {
if err != nil {
t.Fatal(err)
}
cmd.SetOutput(io.Discard)
cmd.SetArgs(append([]string{"prune"}, tt.args...))
err = cmd.Execute()
switch {
Expand Down
2 changes: 2 additions & 0 deletions cmd/restore_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"io"
"net/url"
"testing"

Expand Down Expand Up @@ -49,6 +50,7 @@ func TestRestoreCmd(t *testing.T) {
if err != nil {
t.Fatal(err)
}
cmd.SetOutput(io.Discard)
cmd.SetArgs(append([]string{"restore"}, tt.args...))
err = cmd.Execute()
switch {
Expand Down

0 comments on commit f296491

Please sign in to comment.