diff --git a/workflow/controller/operator_test.go b/workflow/controller/operator_test.go index 7d0eb18d903a..c26788dce514 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) @@ -6288,7 +6299,7 @@ func TestConfigMapCacheSaveOperate(t *testing.T) { ctx := context.Background() woc.operate(ctx) - makePodsPhase(ctx, woc, apiv1.PodSucceeded, withExitCode(0), withOutputs(wfv1.MustMarshallJSON(sampleOutputs))) + makePodsPhase(ctx, woc, apiv1.PodSucceeded, withExitCode(0), withAnnotation(common.AnnotationKeyReportOutputsCompleted, "true"), withOutputs(wfv1.MustMarshallJSON(sampleOutputs))) woc = newWorkflowOperationCtx(woc.wf, controller) woc.operate(ctx) @@ -6578,7 +6589,7 @@ spec: assert.Equal(t, wfv1.WorkflowRunning, woc.wf.Status.Phase) // make all created pods as successful - makePodsPhase(ctx, woc, apiv1.PodSucceeded, withOutputs(`{"parameters": [{"name": "my-param"}]}`)) + makePodsPhase(ctx, woc, apiv1.PodSucceeded, withAnnotation(common.AnnotationKeyReportOutputsCompleted, "true"), withOutputs(`{"parameters": [{"name": "my-param"}]}`)) // reconcile woc = newWorkflowOperationCtx(woc.wf, controller)