diff --git a/pkg/workflow/workflow.go b/pkg/workflow/workflow.go index 0ccd57550..c3d959e82 100644 --- a/pkg/workflow/workflow.go +++ b/pkg/workflow/workflow.go @@ -123,6 +123,9 @@ const ( CondReasonStopped = "Stopped" // CondReasonFailed is the reason of the workflow progress condition which is failed CondReasonFailed = "Failed" + + // CondStatusTrue is the status of the workflow progress condition which is True + CondStatusTrue = "True" ) func (w *workflow) syncWorkflowStatus(step oamcore.WorkflowStep, obj *unstructured.Unstructured) (*common.WorkflowStepStatus, error) { @@ -142,7 +145,7 @@ func (w *workflow) syncWorkflowStatus(step oamcore.WorkflowStep, obj *unstructur return nil, err } - if !found || cond.Status != "True" { + if !found || cond.Status != CondStatusTrue { status.Phase = common.WorkflowStepPhaseRunning return status, nil } diff --git a/pkg/workflow/workflow_test.go b/pkg/workflow/workflow_test.go index 11eff62ce..9dcf8a446 100644 --- a/pkg/workflow/workflow_test.go +++ b/pkg/workflow/workflow_test.go @@ -69,7 +69,7 @@ func TestExecuteSteps(t *testing.T) { "type": CondTypeWorkflowFinish, "reason": CondReasonSucceeded, "message": string(succeededMessage), - "status": "True", + "status": CondStatusTrue, }}, }, }, @@ -84,7 +84,7 @@ func TestExecuteSteps(t *testing.T) { "type": CondTypeWorkflowFinish, "reason": CondReasonSucceeded, "message": string(succeededMessage), - "status": "True", + "status": CondStatusTrue, }}, }, }, @@ -95,7 +95,7 @@ func TestExecuteSteps(t *testing.T) { "status": map[string]interface{}{ "conditions": []interface{}{map[string]interface{}{ "type": CondTypeWorkflowFinish, - "status": "True", + "status": CondStatusTrue, }}, }, }, @@ -106,7 +106,7 @@ func TestExecuteSteps(t *testing.T) { "conditions": []interface{}{map[string]interface{}{ "type": CondTypeWorkflowFinish, "reason": CondReasonStopped, - "status": "True", + "status": CondStatusTrue, }}, }, },