Skip to content

Commit

Permalink
Add explicit equality checks for SupportedKinds
Browse files Browse the repository at this point in the history
Fixes: kubernetes-sigs#1703

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
  • Loading branch information
arkodg committed Feb 7, 2023
1 parent e552a32 commit 2fb2c49
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions conformance/utils/kubernetes/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
"sigs.k8s.io/controller-runtime/pkg/client"

Expand Down Expand Up @@ -636,12 +635,20 @@ func listenersMatch(t *testing.T, expected, actual []v1beta1.ListenerStatus) boo
// Ensure that the expected Listener.SupportedKinds items are present in actual Listener.SupportedKinds
// Find the items instead of performing an exact match of the slice because the implementation
// might support more Kinds than defined in the test
eSupportedKindsSet := sets.New(eListener.SupportedKinds...)
aSupportedKindsSet := sets.New(aListener.SupportedKinds...)
if !aSupportedKindsSet.IsSuperset(eSupportedKindsSet) {
t.Logf("Expected %v kinds to be present in SupportedKinds", eSupportedKindsSet.Difference(aSupportedKindsSet))
return false
for _, eKind := range eListener.SupportedKinds {
found := false
for _, aKind := range aListener.SupportedKinds {
if *eKind.Group == *aKind.Group && eKind.Kind == aKind.Kind {
found = true
break
}
}
if !found {
t.Logf("Expected Group:%s Kind:%s to be present in SupportedKinds", *eKind.Group, eKind.Kind)
return false
}
}

if aListener.AttachedRoutes != eListener.AttachedRoutes {
t.Logf("Expected AttachedRoutes to be %v, got %v", eListener.AttachedRoutes, aListener.AttachedRoutes)
return false
Expand Down

0 comments on commit 2fb2c49

Please sign in to comment.