Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/controller/status/prepare_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ func removeDuplicateIndexParentRefs(parentRefs []graph.ParentRef) []graph.Parent
idxToParentRef[ref.Idx] = append(idxToParentRef[ref.Idx], ref)
}

results := make([]graph.ParentRef, len(idxToParentRef))
results := make([]graph.ParentRef, 0, len(idxToParentRef))

for idx, refs := range idxToParentRef {
if len(refs) == 1 {
results[idx] = refs[0]
results = append(results, refs[0])
continue
}

Expand All @@ -124,7 +124,7 @@ func removeDuplicateIndexParentRefs(parentRefs []graph.ParentRef) []graph.Parent
}
}
}
results[idx] = winningParentRef
results = append(results, winningParentRef)
}

return results
Expand Down
6 changes: 3 additions & 3 deletions internal/controller/status/prepare_requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ func TestBuildHTTPRouteStatuses(t *testing.T) {

err := k8sClient.Get(context.Background(), nsname, &hr)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(helpers.Diff(expected, hr.Status)).To(BeEmpty())
g.Expect(expected.RouteStatus.Parents).To(ConsistOf(hr.Status.Parents))
}
}

Expand Down Expand Up @@ -524,7 +524,7 @@ func TestBuildGRPCRouteStatuses(t *testing.T) {

err := k8sClient.Get(context.Background(), nsname, &hr)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(helpers.Diff(expected, hr.Status)).To(BeEmpty())
g.Expect(expected.RouteStatus.Parents).To(ConsistOf(hr.Status.Parents))
}
}

Expand Down Expand Up @@ -601,7 +601,7 @@ func TestBuildTLSRouteStatuses(t *testing.T) {

err := k8sClient.Get(context.Background(), nsname, &hr)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(helpers.Diff(expected, hr.Status)).To(BeEmpty())
g.Expect(expected.RouteStatus.Parents).To(ConsistOf(hr.Status.Parents))
}
}

Expand Down
Loading