Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
howardjohn committed Aug 15, 2024
1 parent d325715 commit 8fcde39
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions apis/v1/grpcroute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ type GRPCRouteRule struct {
//
// Support: Extended
// +optional
// <gateway:experimental>
Name *SectionName `json:"name,omitempty"`

// Matches define conditions used for matching the rule against incoming
Expand Down
1 change: 1 addition & 0 deletions apis/v1/httproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ type HTTPRouteRule struct {
//
// Support: Extended
// +optional
// <gateway:experimental>
Name *SectionName `json:"name,omitempty"`

// Matches define conditions used for matching the rule against incoming
Expand Down
18 changes: 16 additions & 2 deletions pkg/test/cel/httproute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ import (
"testing"
"time"

gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
)

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1263,6 +1262,21 @@ func TestHTTPRouteRule(t *testing.T) {
},
},
},
{
name: "invalid because multiple names are repeated with others",
wantErrors: []string{"Rule name must be unique within the route"},
rules: []gatewayv1.HTTPRouteRule{
{
Name: ptrTo(gatewayv1.SectionName("name1")),
},
{
Name: ptrTo(gatewayv1.SectionName("not-name1")),
},
{
Name: ptrTo(gatewayv1.SectionName("name1")),
},
},
},
{
name: "valid because names are unique",
wantErrors: nil,
Expand Down

0 comments on commit 8fcde39

Please sign in to comment.