(t *testing.T)
| 1416 | ` |
| 1417 | |
| 1418 | func TestRetriesVariable(t *testing.T) { |
| 1419 | wf := wfv1.MustUnmarshalWorkflow(retriesVariableTemplate) |
| 1420 | cancel, controller := newController(logging.TestContext(t.Context()), wf) |
| 1421 | defer cancel() |
| 1422 | ctx := logging.TestContext(t.Context()) |
| 1423 | iterations := 5 |
| 1424 | var woc *wfOperationCtx |
| 1425 | for i := 1; i <= iterations; i++ { |
| 1426 | woc = newWorkflowOperationCtx(ctx, wf, controller) |
| 1427 | if i != 1 { |
| 1428 | makePodsPhase(ctx, woc, apiv1.PodFailed) |
| 1429 | } |
| 1430 | woc.operate(ctx) |
| 1431 | wf = woc.wf |
| 1432 | } |
| 1433 | |
| 1434 | pods, err := listPods(ctx, woc) |
| 1435 | require.NoError(t, err) |
| 1436 | assert.Len(t, pods.Items, iterations) |
| 1437 | expected := []string{} |
| 1438 | actual := []string{} |
| 1439 | for i := 0; i < iterations; i++ { |
| 1440 | actual = append(actual, pods.Items[i].Spec.Containers[1].Args[0]) |
| 1441 | expected = append(expected, fmt.Sprintf("cowsay %d", i)) |
| 1442 | } |
| 1443 | // ordering not preserved |
| 1444 | assert.ElementsMatch(t, expected, actual) |
| 1445 | } |
| 1446 | |
| 1447 | var retriesVariableInPodSpecPatchTemplate = ` |
| 1448 | apiVersion: argoproj.io/v1alpha1 |
nothing calls this directly
no test coverage detected