Skip to content

Commit

Permalink
fix compile/test errors
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Kriss <stephen.kriss@gmail.com>
  • Loading branch information
skriss committed Jan 9, 2025
1 parent ac5faa2 commit ff6e1ab
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions internal/dag/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5064,7 +5064,7 @@ func TestDAGInsertGatewayAPI(t *testing.T) {
Rules: []gatewayapi_v1.GRPCRouteRule{{
Matches: []gatewayapi_v1.GRPCRouteMatch{{
Method: gatewayapi.GRPCMethodMatch(gatewayapi_v1.GRPCMethodMatchExact, "io.projectcontour", "Login"),
Headers: gatewayapi.GRPCHeaderMatch(gatewayapi_v1.HeaderMatchExact, "version", "2"),
Headers: gatewayapi.GRPCHeaderMatch(gatewayapi_v1.GRPCHeaderMatchExact, "version", "2"),
}},
BackendRefs: gatewayapi.GRPCRouteBackendRef("kuard", 8080, 1),
}},
Expand Down Expand Up @@ -5106,7 +5106,7 @@ func TestDAGInsertGatewayAPI(t *testing.T) {
Rules: []gatewayapi_v1.GRPCRouteRule{{
Matches: []gatewayapi_v1.GRPCRouteMatch{{
Method: gatewayapi.GRPCMethodMatch(gatewayapi_v1.GRPCMethodMatchExact, "io.projectcontour", "Login"),
Headers: gatewayapi.GRPCHeaderMatch(gatewayapi_v1.HeaderMatchRegularExpression, "version", "2+"),
Headers: gatewayapi.GRPCHeaderMatch(gatewayapi_v1.GRPCHeaderMatchRegularExpression, "version", "2+"),
}},
BackendRefs: gatewayapi.GRPCRouteBackendRef("kuard", 8080, 1),
}},
Expand Down Expand Up @@ -5147,7 +5147,7 @@ func TestDAGInsertGatewayAPI(t *testing.T) {
},
Rules: []gatewayapi_v1.GRPCRouteRule{{
Matches: []gatewayapi_v1.GRPCRouteMatch{{
Headers: gatewayapi.GRPCHeaderMatch(gatewayapi_v1.HeaderMatchExact, "version", "2"),
Headers: gatewayapi.GRPCHeaderMatch(gatewayapi_v1.GRPCHeaderMatchExact, "version", "2"),
}},
BackendRefs: gatewayapi.GRPCRouteBackendRef("kuard", 8080, 1),
}},
Expand Down
6 changes: 3 additions & 3 deletions internal/dag/gatewayapi_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1727,10 +1727,10 @@ func gatewayGRPCHeaderMatchConditions(matches []gatewayapi_v1.GRPCHeaderMatch) (
for _, match := range matches {
// "Exact" and "RegularExpression" are the only supported match types. If match type is not specified, use "Exact" as default.
var matchType string
switch ptr.Deref(match.Type, gatewayapi_v1.HeaderMatchExact) {
case gatewayapi_v1.HeaderMatchExact:
switch ptr.Deref(match.Type, gatewayapi_v1.GRPCHeaderMatchExact) {
case gatewayapi_v1.GRPCHeaderMatchExact:
matchType = HeaderMatchTypeExact
case gatewayapi_v1.HeaderMatchRegularExpression:
case gatewayapi_v1.GRPCHeaderMatchRegularExpression:
if err := ValidateRegex(match.Value); err != nil {
return nil, fmt.Errorf("GRPCRoute.Spec.Rules.Matches.Headers: Invalid value for RegularExpression match type is specified")
}
Expand Down
4 changes: 2 additions & 2 deletions internal/dag/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10754,7 +10754,7 @@ func TestGatewayAPIGRPCRouteDAGStatus(t *testing.T) {
},
Headers: []gatewayapi_v1.GRPCHeaderMatch{
{
Type: ptr.To(gatewayapi_v1.HeaderMatchType("UNKNOWN")), // <---- unknown type to break the test
Type: ptr.To(gatewayapi_v1.GRPCHeaderMatchType("UNKNOWN")), // <---- unknown type to break the test
Name: gatewayapi_v1.GRPCHeaderName("foo"),
Value: "bar",
},
Expand Down Expand Up @@ -10809,7 +10809,7 @@ func TestGatewayAPIGRPCRouteDAGStatus(t *testing.T) {
},
Headers: []gatewayapi_v1.GRPCHeaderMatch{
{
Type: ptr.To(gatewayapi_v1.HeaderMatchRegularExpression),
Type: ptr.To(gatewayapi_v1.GRPCHeaderMatchRegularExpression),
Name: gatewayapi_v1.GRPCHeaderName("foo"),
Value: "invalid(-)regex)",
},
Expand Down
2 changes: 1 addition & 1 deletion internal/gatewayapi/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func GRPCMethodMatch(matchType gatewayapi_v1.GRPCMethodMatchType, service, metho
}
}

func GRPCHeaderMatch(matchType gatewayapi_v1.HeaderMatchType, name, value string) []gatewayapi_v1.GRPCHeaderMatch {
func GRPCHeaderMatch(matchType gatewayapi_v1.GRPCHeaderMatchType, name, value string) []gatewayapi_v1.GRPCHeaderMatch {
return []gatewayapi_v1.GRPCHeaderMatch{
{
Type: ptr.To(matchType),
Expand Down
10 changes: 5 additions & 5 deletions internal/provisioner/controller/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1276,13 +1276,13 @@ func TestGatewayReconcile(t *testing.T) {
Spec: gatewayapi_v1.GatewaySpec{
GatewayClassName: gatewayapi_v1.ObjectName("gatewayclass-1"),
Infrastructure: &gatewayapi_v1.GatewayInfrastructure{
Labels: map[gatewayapi_v1.AnnotationKey]gatewayapi_v1.AnnotationValue{
gatewayapi_v1.AnnotationKey("projectcontour.io/label-1"): gatewayapi_v1.AnnotationValue("label-value-1"),
gatewayapi_v1.AnnotationKey("projectcontour.io/label-2"): gatewayapi_v1.AnnotationValue("label-value-2"),
Labels: map[gatewayapi_v1.LabelKey]gatewayapi_v1.LabelValue{
"projectcontour.io/label-1": "label-value-1",
"projectcontour.io/label-2": "label-value-2",
},
Annotations: map[gatewayapi_v1.AnnotationKey]gatewayapi_v1.AnnotationValue{
gatewayapi_v1.AnnotationKey("projectcontour.io/annotation-1"): gatewayapi_v1.AnnotationValue("annotation-value-1"),
gatewayapi_v1.AnnotationKey("projectcontour.io/annotation-2"): gatewayapi_v1.AnnotationValue("annotation-value-2"),
"projectcontour.io/annotation-1": "annotation-value-1",
"projectcontour.io/annotation-2": "annotation-value-2",
},
},
},
Expand Down

0 comments on commit ff6e1ab

Please sign in to comment.