Add -u/--update and -v/--verbose flags to e2e integration cli tests

master
James Mills 2 days ago
parent f7c11af57d
commit a560af7306
Signed by: prologic
GPG Key ID: AC4C014F1440EBD6
  1. 8
      tests/cli_test.go

@ -1,10 +1,10 @@
package tests
import (
"flag"
"testing"
"github.com/google/go-cmdtest"
flag "github.com/spf13/pflag"
"git.mills.io/prologic/box/cgroups"
"git.mills.io/prologic/box/cli"
@ -12,7 +12,10 @@ import (
const binaryName = "box"
var update = flag.Bool("update", false, "update test files with results")
var (
update = flag.BoolP("update", "u", false, "update test files with results")
verbose = flag.BoolP("verbose", "v", false, "enable verbose logging")
)
func TestCLI(t *testing.T) {
if err := cgroups.Check(); err != nil {
@ -24,6 +27,7 @@ func TestCLI(t *testing.T) {
if err != nil {
t.Fatal(err)
}
ts.DisableLogging = !*verbose
ts.Commands[binaryName] = cmdtest.InProcessProgram(binaryName, cli.Run)
ts.Run(t, *update)
}

Loading…
Cancel
Save