add const CondStatusTrue

This commit is contained in:
Hongchao Deng
2021-06-02 08:58:59 -07:00
parent b93460cbb4
commit fd13fb4441
2 changed files with 8 additions and 5 deletions
+4 -1
View File
@@ -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
}
+4 -4
View File
@@ -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,
}},
},
},