Skip to content

Commit

Permalink
fix test description
Browse files Browse the repository at this point in the history
  • Loading branch information
salonichf5 committed Aug 2, 2024
1 parent 04286b8 commit 581a0c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 3 additions & 0 deletions internal/mode/static/state/graph/gateway_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ func validateListenerHostname(listener v1.Listener) (conds []conditions.Conditio
return nil, true
}

// getAndValidateListenerSupportedKinds validates the route kind and returns the supported kinds for the listener.
// The supported kinds are determined based on the listener's allowedRoutes field.
// If the listener does not specify allowedRoutes, listener determines allowed routes based on its protocol.
func getAndValidateListenerSupportedKinds(listener v1.Listener) (
[]conditions.Condition,
[]v1.RouteGroupKind,
Expand Down
2 changes: 0 additions & 2 deletions internal/mode/static/state/graph/route_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,6 @@ func isRouteNamespaceAllowedByListener(
}

// isRouteKindAllowedByListener checks if the route is allowed to attach to the listener.
// If the listener specifies allowed kinds, the route kind must be in the list.
// If the listener does not specify allowedRoutes, allowed routes are determined using the listener protocol.
func isRouteTypeAllowedByListener(listener *Listener, routeType RouteType) bool {
for _, kind := range listener.SupportedKinds {
if kind.Kind == convertRouteType(routeType) {
Expand Down
8 changes: 4 additions & 4 deletions internal/mode/static/state/graph/route_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ func TestAllowedRouteType(t *testing.T) {
expResult bool
}{
{
name: "grpcRoute attaches to listener with allowedRoutes set to grpcRoute",
name: "grpcRoute is allowed when listener supports grpcRoute kind",
routeType: RouteTypeGRPC,
listener: &Listener{
SupportedKinds: []gatewayv1.RouteGroupKind{
Expand All @@ -1753,7 +1753,7 @@ func TestAllowedRouteType(t *testing.T) {
expResult: true,
},
{
name: "grpcRoute attaches to listener with allowedRoutes set to grpcRoute and httpRoute",
name: "grpcRoute is allowed when listener supports grpcRoute and httpRoute kind",
routeType: RouteTypeGRPC,
listener: &Listener{
SupportedKinds: []gatewayv1.RouteGroupKind{
Expand All @@ -1764,7 +1764,7 @@ func TestAllowedRouteType(t *testing.T) {
expResult: true,
},
{
name: "grpcRoute not allowed to attach to listener with allowedRoutes set to httpRoute",
name: "grpcRoute is allowed when listener supports httpRoute kind",
routeType: RouteTypeGRPC,
listener: &Listener{
SupportedKinds: []gatewayv1.RouteGroupKind{
Expand All @@ -1774,7 +1774,7 @@ func TestAllowedRouteType(t *testing.T) {
expResult: false,
},
{
name: "httpRoute not allowed to attach to listener with allowedRoutes set to grpcRoute",
name: "httpRoute not allowed when listener supports grpcRoute kind",
routeType: RouteTypeHTTP,
listener: &Listener{
SupportedKinds: []gatewayv1.RouteGroupKind{
Expand Down

0 comments on commit 581a0c0

Please sign in to comment.