@@ -23,6 +23,7 @@ import (
2323 "github.com/kong/kubernetes-ingress-controller/v2/internal/annotations"
2424 gatewaypkg "github.com/kong/kubernetes-ingress-controller/v2/internal/controllers/gateway"
2525 "github.com/kong/kubernetes-ingress-controller/v2/internal/util"
26+ "github.com/kong/kubernetes-ingress-controller/v2/internal/util/builder"
2627 "github.com/kong/kubernetes-ingress-controller/v2/internal/versions"
2728 kongv1 "github.com/kong/kubernetes-ingress-controller/v2/pkg/apis/configuration/v1"
2829 "github.com/kong/kubernetes-ingress-controller/v2/pkg/clientset"
@@ -541,8 +542,6 @@ func TestHTTPRouteFilterHosts(t *testing.T) {
541542 require .NoError (t , err )
542543
543544 t .Logf ("creating an httproute with a same hostname and another unmatched hostname" )
544- httpPort := gatewayv1beta1 .PortNumber (80 )
545- pathMatchPrefix := gatewayv1beta1 .PathMatchPathPrefix
546545 httpRoute := & gatewayv1beta1.HTTPRoute {
547546 ObjectMeta : metav1.ObjectMeta {
548547 Name : uuid .NewString (),
@@ -563,22 +562,11 @@ func TestHTTPRouteFilterHosts(t *testing.T) {
563562 },
564563 Rules : []gatewayv1beta1.HTTPRouteRule {{
565564 Matches : []gatewayv1beta1.HTTPRouteMatch {
566- {
567- Path : & gatewayv1beta1.HTTPPathMatch {
568- Type : & pathMatchPrefix ,
569- Value : kong .String ("/test-http-route-filter-hosts" ),
570- },
571- },
565+ builder .NewHTTPRouteMatch ().WithPathPrefix ("/test-http-route-filter-hosts" ).Build (),
566+ },
567+ BackendRefs : []gatewayv1beta1.HTTPBackendRef {
568+ builder .NewHTTPBackendRef (service .Name ).WithPort (80 ).Build (),
572569 },
573- BackendRefs : []gatewayv1beta1.HTTPBackendRef {{
574- BackendRef : gatewayv1beta1.BackendRef {
575- BackendObjectReference : gatewayv1beta1.BackendObjectReference {
576- Name : gatewayv1beta1 .ObjectName (service .Name ),
577- Port : & httpPort ,
578- Kind : util .StringToGatewayAPIKindPtr ("Service" ),
579- },
580- },
581- }},
582570 }},
583571 },
584572 }
0 commit comments