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

Function TestRetriesVariable

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

Source from the content-addressed store, hash-verified

1416`
1417
1418func 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
1447var retriesVariableInPodSpecPatchTemplate = `
1448apiVersion: argoproj.io/v1alpha1

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