mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-14 13:26:44 +00:00
Fix: fix workflow cli must have workflow in spec (#3469)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user