Add unit test for workflow
This commit is contained in:
parent
a8e649eb67
commit
44f208ccad
22
cmd/workflow/testdata/TestWorkflowGoldenOutput/workflow.golden
vendored
Normal file
22
cmd/workflow/testdata/TestWorkflowGoldenOutput/workflow.golden
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Access to argo workflows
|
||||
|
||||
Usage:
|
||||
airshipctl workflow [command]
|
||||
|
||||
Aliases:
|
||||
workflow, workflows, wf
|
||||
|
||||
Available Commands:
|
||||
init bootstraps the kubernetes cluster with the Workflow CRDs and controller
|
||||
list list workflows
|
||||
|
||||
Flags:
|
||||
--all-namespaces use all kubernetes namespaces for the context of this command
|
||||
-h, --help help for workflow
|
||||
--kubeconfig string path to kubeconfig
|
||||
--namespace string kubernetes namespace to use for the context of this command (default "default")
|
||||
|
||||
Global Flags:
|
||||
--debug enable verbose output
|
||||
|
||||
Use "airshipctl workflow [command] --help" for more information about a command.
|
@ -1,8 +1,13 @@
|
||||
package workflow_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/ian-howell/airshipctl/cmd"
|
||||
"github.com/ian-howell/airshipctl/cmd/workflow"
|
||||
wfenv "github.com/ian-howell/airshipctl/pkg/workflow/environment"
|
||||
"github.com/ian-howell/airshipctl/test"
|
||||
)
|
||||
|
||||
@ -12,3 +17,28 @@ type WorkflowCmdTest struct {
|
||||
CRDObjs []runtime.Object
|
||||
ArgoObjs []runtime.Object
|
||||
}
|
||||
|
||||
func TestWorkflow(t *testing.T) {
|
||||
rootCmd, settings, err := cmd.NewRootCmd(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not create root command: %s", err.Error())
|
||||
}
|
||||
workflowRoot := workflow.NewWorkflowCommand(settings)
|
||||
rootCmd.AddCommand(workflowRoot)
|
||||
|
||||
cmdTests := []WorkflowCmdTest{
|
||||
{
|
||||
CmdTest: &test.CmdTest{
|
||||
Name: "workflow",
|
||||
CmdLine: "workflow",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range cmdTests {
|
||||
settings.PluginSettings[workflow.PluginSettingsID] = &wfenv.Settings{
|
||||
Initialized: true,
|
||||
}
|
||||
test.RunTest(t, tt.CmdTest, rootCmd)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user