Fix: fix workflow cli must have workflow in spec (#3469)

Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
This commit is contained in:
Tianxin Dong
2022-03-23 17:16:39 +08:00
committed by GitHub
parent c5baa1cae9
commit aaa1db8760
2 changed files with 0 additions and 48 deletions

View File

@@ -70,9 +70,6 @@ func NewWorkflowSuspendCommand(c common.Args, ioStream cmdutil.IOStreams) *cobra
if err != nil {
return err
}
if app.Spec.Workflow == nil {
return fmt.Errorf("the application must have workflow")
}
if app.Status.Workflow == nil {
return fmt.Errorf("the workflow in application is not running")
}
@@ -158,9 +155,6 @@ func NewWorkflowTerminateCommand(c common.Args, ioStream cmdutil.IOStreams) *cob
if err != nil {
return err
}
if app.Spec.Workflow == nil {
return fmt.Errorf("the application must have workflow")
}
if app.Status.Workflow == nil {
return fmt.Errorf("the workflow in application is not running")
}
@@ -198,9 +192,6 @@ func NewWorkflowRestartCommand(c common.Args, ioStream cmdutil.IOStreams) *cobra
if err != nil {
return err
}
if app.Spec.Workflow == nil {
return fmt.Errorf("the application must have workflow")
}
if app.Status.Workflow == nil {
return fmt.Errorf("the workflow in application is not running")
}
@@ -239,9 +230,6 @@ func NewWorkflowRollbackCommand(c common.Args, ioStream cmdutil.IOStreams) *cobr
if err != nil {
return err
}
if app.Spec.Workflow == nil {
return fmt.Errorf("the application must have workflow")
}
if app.Status.Workflow != nil && !app.Status.Workflow.Terminated && !app.Status.Workflow.Suspend && !app.Status.Workflow.Finished {
return fmt.Errorf("can not rollback a running workflow")
}

View File

@@ -60,15 +60,6 @@ func TestWorkflowSuspend(t *testing.T) {
"no app name specified": {
expectedErr: fmt.Errorf("must specify application name"),
},
"no workflow in app": {
app: &v1beta1.Application{
ObjectMeta: metav1.ObjectMeta{
Name: "no-workflow",
Namespace: "default",
},
},
expectedErr: fmt.Errorf("the application must have workflow"),
},
"workflow not running": {
app: &v1beta1.Application{
ObjectMeta: metav1.ObjectMeta{
@@ -260,15 +251,6 @@ func TestWorkflowTerminate(t *testing.T) {
"no app name specified": {
expectedErr: fmt.Errorf("must specify application name"),
},
"no workflow in app": {
app: &v1beta1.Application{
ObjectMeta: metav1.ObjectMeta{
Name: "no-workflow",
Namespace: "default",
},
},
expectedErr: fmt.Errorf("the application must have workflow"),
},
"workflow not running": {
app: &v1beta1.Application{
ObjectMeta: metav1.ObjectMeta{
@@ -349,15 +331,6 @@ func TestWorkflowRestart(t *testing.T) {
"no app name specified": {
expectedErr: fmt.Errorf("must specify application name"),
},
"no workflow in app": {
app: &v1beta1.Application{
ObjectMeta: metav1.ObjectMeta{
Name: "no-workflow",
Namespace: "default",
},
},
expectedErr: fmt.Errorf("the application must have workflow"),
},
"workflow not running": {
app: &v1beta1.Application{
ObjectMeta: metav1.ObjectMeta{
@@ -440,15 +413,6 @@ func TestWorkflowRollback(t *testing.T) {
"no app name specified": {
expectedErr: fmt.Errorf("must specify application name"),
},
"no workflow in app": {
app: &v1beta1.Application{
ObjectMeta: metav1.ObjectMeta{
Name: "no-workflow",
Namespace: "default",
},
},
expectedErr: fmt.Errorf("the application must have workflow"),
},
"workflow running": {
app: &v1beta1.Application{
ObjectMeta: metav1.ObjectMeta{