(t *testing.T)
| 1639 | ` |
| 1640 | |
| 1641 | func 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 | |
| 1672 | func TestAssessNodeStatus(t *testing.T) { |
| 1673 | const templateName = "whalesay" |
nothing calls this directly
no test coverage detected