cmd: test command checks

This commit is contained in:
Vincent Bernat
2023-07-30 20:27:38 +02:00
parent e88b53eada
commit 02e527915b
5 changed files with 63 additions and 1 deletions

View File

@@ -4,6 +4,7 @@
package cmd
import (
"bytes"
"testing"
"akvorado/common/reporter"
@@ -17,3 +18,14 @@ func TestConsoleStart(t *testing.T) {
t.Fatalf("consoleStart() error:\n%+v", err)
}
}
func TestConsole(t *testing.T) {
root := RootCmd
buf := new(bytes.Buffer)
root.SetOut(buf)
root.SetArgs([]string{"console", "--check", "/dev/null"})
err := root.Execute()
if err != nil {
t.Errorf("`console` error:\n%+v", err)
}
}