Update unit tests to use fake client
This commit is contained in:
parent
039224b6fe
commit
c680f20dd8
@ -9,7 +9,9 @@ Available Commands:
|
||||
workflow Access to argo workflows
|
||||
|
||||
Flags:
|
||||
--debug enable verbose output
|
||||
-h, --help help for airshipctl
|
||||
--debug enable verbose output
|
||||
-h, --help help for airshipctl
|
||||
--kubeconfig string path to kubeconfig
|
||||
--namespace string kubernetes namespace to use for the context of this command (default "default")
|
||||
|
||||
Use "airshipctl [command] --help" for more information about a command.
|
||||
|
@ -10,6 +10,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ian-howell/airshipctl/cmd"
|
||||
"github.com/ian-howell/airshipctl/pkg/environment"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
)
|
||||
|
||||
// UpdateGolden writes out the golden files with the latest values, rather than failing the test.
|
||||
@ -42,9 +44,12 @@ func RunCmdTests(t *testing.T, tests []CmdTest) {
|
||||
|
||||
func executeCmd(t *testing.T, command string) []byte {
|
||||
var actual bytes.Buffer
|
||||
settings := &environment.AirshipCTLSettings{
|
||||
KubeClient: fake.NewSimpleClientset(),
|
||||
}
|
||||
// TODO(howell): switch to shellwords (or similar)
|
||||
args := strings.Fields(command)
|
||||
rootCmd, err := cmd.NewRootCmd(&actual, args)
|
||||
rootCmd, err := cmd.NewRootCmd(&actual, settings, args)
|
||||
if err != nil {
|
||||
t.Fatalf(err.Error())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user