Skip to content

Commit

Permalink
fix(controller): Fix getPodByNode, TestGetPodByNode. Fixes #6458 (#6897)
Browse files Browse the repository at this point in the history
Signed-off-by: Micah Beeman <micah.beeman@workiva.com>
  • Loading branch information
micahbeeman-wf committed Oct 15, 2021
1 parent 9efc9e8 commit 41515d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2190,7 +2190,8 @@ func (woc *wfOperationCtx) getPodByNode(node *wfv1.NodeStatus) (*apiv1.Pod, erro
if node.Type != wfv1.NodeTypePod {
return nil, fmt.Errorf("Expected node type %s, got %s", wfv1.NodeTypePod, node.Type)
}
return woc.controller.getPod(woc.wf.GetNamespace(), node.ID)
podName := wfutil.PodName(woc.wf.Name, node.Name, node.TemplateName, node.ID)
return woc.controller.getPod(woc.wf.GetNamespace(), podName)
}

func (woc *wfOperationCtx) recordNodePhaseEvent(node *wfv1.NodeStatus) {
Expand Down
2 changes: 1 addition & 1 deletion workflow/controller/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3519,7 +3519,6 @@ func getEvents(controller *WorkflowController, num int) []string {
}

func TestGetPodByNode(t *testing.T) {
t.Skip("See https://github.com/argoproj/argo-workflows/issues/6458")
workflowText := `
metadata:
name: dag-events
Expand All @@ -3543,6 +3542,7 @@ spec:
woc := newWorkflowOperationCtx(wf, controller)
createRunningPods(ctx, woc)
woc.operate(ctx)
time.Sleep(time.Second)
// Parent dag node has no pod
parentNode := woc.wf.GetNodeByName("dag-events")
pod, err := woc.getPodByNode(parentNode)
Expand Down

0 comments on commit 41515d6

Please sign in to comment.