MCPcopy
hub / github.com/argoproj/argo-workflows / TestStepsRetriesVariable

Function TestStepsRetriesVariable

workflow/controller/operator_test.go:1641–1670  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1639`
1640
1641func TestStepsRetriesVariable(t *testing.T) {
1642 wf := wfv1.MustUnmarshalWorkflow(stepsRetriesVariableTemplate)
1643 cancel, controller := newController(logging.TestContext(t.Context()), wf)
1644 defer cancel()
1645 ctx := logging.TestContext(t.Context())
1646 iterations := 5
1647 var woc *wfOperationCtx
1648 for i := 1; i <= iterations; i++ {
1649 woc = newWorkflowOperationCtx(ctx, wf, controller)
1650 if i != 1 {
1651 makePodsPhase(ctx, woc, apiv1.PodFailed)
1652 }
1653 // move to next retry step
1654 woc.operate(ctx)
1655 wf = woc.wf
1656 }
1657
1658 pods, err := listPods(ctx, woc)
1659 require.NoError(t, err)
1660 assert.Len(t, pods.Items, iterations)
1661
1662 expected := []string{}
1663 actual := []string{}
1664 for i := 0; i < iterations; i++ {
1665 actual = append(actual, pods.Items[i].Spec.Containers[1].Args[0])
1666 expected = append(expected, fmt.Sprintf("cowsay %d", i))
1667 }
1668 // ordering not preserved
1669 assert.ElementsMatch(t, expected, actual)
1670}
1671
1672func TestAssessNodeStatus(t *testing.T) {
1673 const templateName = "whalesay"

Callers

nothing calls this directly

Calls 9

operateMethod · 0.95
TestContextFunction · 0.92
newControllerFunction · 0.85
cancelFunction · 0.85
newWorkflowOperationCtxFunction · 0.85
makePodsPhaseFunction · 0.85
listPodsFunction · 0.85
ContextMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected