Skip to content

Commit

Permalink
Fix SupportedKinds check
Browse files Browse the repository at this point in the history
* Find the expcted SupportedKind element in the actual SupportedKind
slice instead of doing an exact match because the actual/implementation
populated SupportedKinds field might support more Kind that defined in
the test.

Fixes: #1691

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
  • Loading branch information
arkodg committed Feb 1, 2023
1 parent 8694ac9 commit 4fb1341
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions conformance/utils/kubernetes/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,21 @@ func listenersMatch(t *testing.T, expected, actual []v1beta1.ListenerStatus) boo
t.Logf("Name doesn't match")
return false
}
if !reflect.DeepEqual(aListener.SupportedKinds, eListener.SupportedKinds) {
t.Logf("Expected SupportedKinds to be %v, got %v", eListener.SupportedKinds, aListener.SupportedKinds)
return false
// 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
for _, eKind := range eListener.SupportedKinds {
found := false
for _, aKind := range aListener.SupportedKinds {
if eKind.Kind == aKind.Kind {
found = true
break
}
}
if !found {
t.Logf("Expected %s to be present in SupportedKinds", eKind.Kind)
return false
}
}
if aListener.AttachedRoutes != eListener.AttachedRoutes {
t.Logf("Expected AttachedRoutes to be %v, got %v", eListener.AttachedRoutes, aListener.AttachedRoutes)
Expand Down

0 comments on commit 4fb1341

Please sign in to comment.