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

Function TestCounters

workflow/controller/node_counters_test.go:132–153  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

130`
131
132func TestCounters(t *testing.T) {
133 woc := getWfOperationCtx()
134 var pod v1.Pod
135 v1alpha1.MustUnmarshal([]byte(podStr), &pod)
136 assert.NotNil(t, pod)
137 pod1 := pod.DeepCopy()
138 pod1.Name = "2"
139 cancel, controller := newController(logging.TestContext(t.Context()))
140 defer cancel()
141 woc.controller = controller
142 syncPodsInformer(logging.TestContext(t.Context()), woc, pod, *pod1)
143 assert.Equal(t, int64(2), woc.getActivePods("1"))
144 // No BoundaryID requested
145 assert.Equal(t, int64(4), woc.getActivePods(""))
146 assert.Equal(t, int64(5), woc.getActiveChildren("1"))
147 assert.Equal(t, int64(3), woc.getUnsuccessfulChildren("1"))
148 assert.Equal(t, int64(2), woc.getActivePods("2"))
149 assert.Equal(t, int64(2), woc.getActiveChildren("2"))
150 assert.Equal(t, int64(2), woc.getUnsuccessfulChildren("2"))
151
152 testNodePodExists(t, woc)
153}
154
155func testNodePodExists(t *testing.T, woc *wfOperationCtx) {
156 for _, node := range woc.wf.Status.Nodes {

Callers

nothing calls this directly

Calls 12

MustUnmarshalFunction · 0.92
TestContextFunction · 0.92
getWfOperationCtxFunction · 0.85
newControllerFunction · 0.85
cancelFunction · 0.85
syncPodsInformerFunction · 0.85
testNodePodExistsFunction · 0.85
getActivePodsMethod · 0.80
getActiveChildrenMethod · 0.80
ContextMethod · 0.65
DeepCopyMethod · 0.45

Tested by

no test coverage detected