Skip to content

Commit

Permalink
test(k8s): update test
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Beaumont <mjboamail@gmail.com>
  • Loading branch information
michaelbeaumont committed Apr 29, 2024
1 parent 0a3b057 commit 9cd7f9b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pkg/plugins/runtime/k8s/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"sigs.k8s.io/yaml"

"github.com/kumahq/kuma/pkg/plugins/runtime/k8s/util"
"github.com/kumahq/kuma/pkg/util/maps"
)

var _ = Describe("Util", func() {
Expand Down Expand Up @@ -98,15 +99,9 @@ var _ = Describe("Util", func() {
DescribeTable("FindServices",
func(pod *kube_core.Pod, svcs *kube_core.ServiceList, matchSvcNames []string) {
// when
matchingServices := util.FindServices(svcs, util.AnySelector(), util.MatchServiceThatSelectsPod(pod, nil))
matchingServices := util.FindServicesByName(svcs, util.AnySelector(), util.MatchServiceThatSelectsPod(pod, nil))
// then
Expect(matchingServices).To(WithTransform(func(svcs []*kube_core.Service) []string {
var res []string
for i := range svcs {
res = append(res, svcs[i].Name)
}
return res
}, Equal(matchSvcNames)))
Expect(maps.SortedKeys(matchingServices)).To(Equal(matchSvcNames))
},
Entry("should match services by a predicate",
&kube_core.Pod{
Expand Down

0 comments on commit 9cd7f9b

Please sign in to comment.