Fix route attachments to gateways

Co-authored-by: Romain <rtribotte@users.noreply.github.com>
This commit is contained in:
Kevin Pollet 2024-05-28 14:30:04 +02:00 committed by GitHub
parent 6e61fe0de1
commit e9bd2b45ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 2243 additions and 2498 deletions

View file

@ -8,7 +8,7 @@ import (
gatev1 "sigs.k8s.io/gateway-api/apis/v1"
)
func TestStatusEquals(t *testing.T) {
func Test_gatewayStatusEquals(t *testing.T) {
testCases := []struct {
desc string
statusA gatev1.GatewayStatus
@ -230,13 +230,45 @@ func TestStatusEquals(t *testing.T) {
},
expected: false,
},
{
desc: "Gateway listeners with same conditions but different number of attached routes",
statusA: gatev1.GatewayStatus{
Listeners: []gatev1.ListenerStatus{
{
Name: "foo",
AttachedRoutes: 1,
Conditions: []metav1.Condition{
{
Type: "foobar",
Reason: "foobar",
},
},
},
},
},
statusB: gatev1.GatewayStatus{
Listeners: []gatev1.ListenerStatus{
{
Name: "foo",
AttachedRoutes: 2,
Conditions: []metav1.Condition{
{
Type: "foobar",
Reason: "foobar",
},
},
},
},
},
expected: false,
},
}
for _, test := range testCases {
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
result := statusEquals(test.statusA, test.statusB)
result := gatewayStatusEquals(test.statusA, test.statusB)
assert.Equal(t, test.expected, result)
})