Skip to content

Commit

Permalink
fix(test): test logged progress with initial progress and workflow us…
Browse files Browse the repository at this point in the history
…es legacy/insecure pod patch. Fixes #13057

Signed-off-by: jswxstw <[email protected]>
  • Loading branch information
jswxstw committed Jun 28, 2024
1 parent 789bc17 commit 94a9e04
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions workflow/controller/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ spec:
- name: pod
template: pod
- name: pod
metadata:
annotations:
workflows.argoproj.io/progress: 0/100
container:
image: my-image
`)
Expand All @@ -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)

Expand Down

0 comments on commit 94a9e04

Please sign in to comment.