Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
Signed-off-by: isubasinghe <[email protected]>
  • Loading branch information
isubasinghe committed Oct 14, 2024
1 parent 41c2644 commit 660d0f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
8 changes: 1 addition & 7 deletions workflow/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,6 @@ func newWorkflowsDag(wf *wfv1.Workflow) ([]*node, error) {
// create mapping from node to parent
// as well as creating temp mappings from nodeID to node
for _, wfNode := range wf.Status.Nodes {
wfNode := wfNode
n := node{}
n.n = &wfNode
nodes[wfNode.ID] = &n
Expand All @@ -850,7 +849,6 @@ func newWorkflowsDag(wf *wfv1.Workflow) ([]*node, error) {
}

for _, wfNode := range wf.Status.Nodes {
wfNode := wfNode
parentWfNode, ok := parentsMap[wfNode.ID]
if !ok && wfNode.Name != wf.Name && !strings.HasPrefix(wfNode.Name, wf.ObjectMeta.Name+".onExit") {
return nil, fmt.Errorf("couldn't find parent node for %s", wfNode.ID)
Expand Down Expand Up @@ -1081,7 +1079,6 @@ func resetPath(isOnExitNode bool, onExitNodeName string, allNodes []*node, toNod
return nil, nil, fmt.Errorf("must find %s but reached the root node", mustFind)
}

err = nil
switch mustFind {
case wfv1.NodeTypePod:
curr, err = consumePod(curr, addToReset, addToDelete)
Expand Down Expand Up @@ -1150,10 +1147,7 @@ func dagSortedNodes(nodes []*node, rootNodeName string) []*node {
curr := queue[0]
sortedNodes = append(sortedNodes, curr)
queue = queue[1:]

for i := range curr.children {
queue = append(queue, curr.children[i])
}
queue = append(queue, curr.children...)
}

return sortedNodes
Expand Down
5 changes: 3 additions & 2 deletions workflow/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1859,8 +1859,8 @@ func TestRetryWorkflowWithNestedDAGsWithSuspendNodes(t *testing.T) {
// Retry top individual pod node
wf, podsToDelete, err := FormulateRetryWorkflow(ctx, wf, true, "name=fail-two-nested-dag-suspend.dag1-step1", nil)
require.NoError(t, err)
assert.Equal(t, 1, len(wf.Status.Nodes))
assert.Equal(t, 6, len(podsToDelete))
assert.Len(t, wf.Status.Nodes, 1)
assert.Len(t, podsToDelete, 6)

// Retry top individual suspend node
wf = wfv1.MustUnmarshalWorkflow(retryWorkflowWithNestedDAGsWithSuspendNodes)
Expand Down Expand Up @@ -1931,6 +1931,7 @@ func TestRetryWorkflowWithNestedDAGsWithSuspendNodes(t *testing.T) {
// Retry the second individual node (pod node) connecting to the second DAG in one of the branches
wf = wfv1.MustUnmarshalWorkflow(retryWorkflowWithNestedDAGsWithSuspendNodes)
wf, podsToDelete, err = FormulateRetryWorkflow(ctx, wf, true, "name=fail-two-nested-dag-suspend.dag1-step3-middle2.dag2-branch2-step1.dag3-step2", nil)
require.NoError(t, err)
assert.Len(t, wf.Status.Nodes, 12)
assert.Equal(t, wfv1.NodeRunning, wf.Status.Nodes["fail-two-nested-dag-suspend"].Phase)
assert.Equal(t, wfv1.NodeSucceeded, wf.Status.Nodes.FindByName("fail-two-nested-dag-suspend.dag1-step1").Phase)
Expand Down

0 comments on commit 660d0f2

Please sign in to comment.