diff --git a/workflow/controller/operator_test.go b/workflow/controller/operator_test.go index 7d0eb18d903a..68e5952f9717 100644 --- a/workflow/controller/operator_test.go +++ b/workflow/controller/operator_test.go @@ -280,6 +280,9 @@ spec: - name: pod template: pod - name: pod + metadata: + annotations: + workflows.argoproj.io/progress: 0/100 container: image: my-image `) @@ -290,17 +293,25 @@ spec: woc := newWorkflowOperationCtx(wf, controller) woc.operate(ctx) - makePodsPhase(ctx, woc, apiv1.PodRunning, withProgress("50/100")) + assert.Equal(t, wfv1.WorkflowRunning, woc.wf.Status.Phase) + assert.Equal(t, wfv1.Progress("0/100"), woc.wf.Status.Progress) + assert.Equal(t, wfv1.Progress("0/100"), woc.wf.Status.Nodes[woc.wf.Name].Progress) + pod := woc.wf.Status.Nodes.FindByDisplayName("pod") + assert.Equal(t, wfv1.Progress("0/100"), pod.Progress) + + // mock workflow uses legacy/insecure pod patch + makePodsPhase(ctx, woc, apiv1.PodRunning, withAnnotation(common.AnnotationKeyReportOutputsCompleted, "false"), withProgress("50/100")) woc = newWorkflowOperationCtx(woc.wf, controller) woc.operate(ctx) assert.Equal(t, wfv1.WorkflowRunning, woc.wf.Status.Phase) assert.Equal(t, wfv1.Progress("50/100"), woc.wf.Status.Progress) assert.Equal(t, wfv1.Progress("50/100"), woc.wf.Status.Nodes[woc.wf.Name].Progress) - pod := woc.wf.Status.Nodes.FindByDisplayName("pod") + pod = woc.wf.Status.Nodes.FindByDisplayName("pod") assert.Equal(t, wfv1.Progress("50/100"), pod.Progress) - makePodsPhase(ctx, woc, apiv1.PodSucceeded, withProgress("100/100")) + // mock workflow uses legacy/insecure pod patch + makePodsPhase(ctx, woc, apiv1.PodSucceeded, withAnnotation(common.AnnotationKeyReportOutputsCompleted, "true"), withProgress("100/100")) woc = newWorkflowOperationCtx(woc.wf, controller) woc.operate(ctx)