Skip to content

Commit d04aabf

Browse files
micahbeeman-wfsarabala1979
authored andcommitted
fix(controller): Fix getPodByNode, TestGetPodByNode. Fixes argoproj#6458 (argoproj#6897)
Signed-off-by: Micah Beeman <[email protected]>
1 parent 72446bf commit d04aabf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

workflow/controller/operator.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2190,7 +2190,8 @@ func (woc *wfOperationCtx) getPodByNode(node *wfv1.NodeStatus) (*apiv1.Pod, erro
21902190
if node.Type != wfv1.NodeTypePod {
21912191
return nil, fmt.Errorf("Expected node type %s, got %s", wfv1.NodeTypePod, node.Type)
21922192
}
2193-
return woc.controller.getPod(woc.wf.GetNamespace(), node.ID)
2193+
podName := wfutil.PodName(woc.wf.Name, node.Name, node.TemplateName, node.ID)
2194+
return woc.controller.getPod(woc.wf.GetNamespace(), podName)
21942195
}
21952196

21962197
func (woc *wfOperationCtx) recordNodePhaseEvent(node *wfv1.NodeStatus) {

workflow/controller/operator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3519,7 +3519,6 @@ func getEvents(controller *WorkflowController, num int) []string {
35193519
}
35203520

35213521
func TestGetPodByNode(t *testing.T) {
3522-
t.Skip("See https://github.com/argoproj/argo-workflows/issues/6458")
35233522
workflowText := `
35243523
metadata:
35253524
name: dag-events
@@ -3543,6 +3542,7 @@ spec:
35433542
woc := newWorkflowOperationCtx(wf, controller)
35443543
createRunningPods(ctx, woc)
35453544
woc.operate(ctx)
3545+
time.Sleep(time.Second)
35463546
// Parent dag node has no pod
35473547
parentNode := woc.wf.GetNodeByName("dag-events")
35483548
pod, err := woc.getPodByNode(parentNode)

0 commit comments

Comments
 (0)