@@ -446,8 +446,47 @@ func Test_ToIR(t *testing.T) {
446446 {Namespace : "test" , Name : "example2" }: {"http" : 8080 },
447447 },
448448 expectedIR : intermediate.IR {
449- Gateways : map [types.NamespacedName ]intermediate.GatewayContext {},
450- HTTPRoutes : map [types.NamespacedName ]intermediate.HTTPRouteContext {},
449+ Gateways : map [types.NamespacedName ]intermediate.GatewayContext {
450+ {Namespace : "test" , Name : "named-ports" }: {
451+ Gateway : gatewayv1.Gateway {
452+ ObjectMeta : metav1.ObjectMeta {Name : "named-ports" , Namespace : "test" },
453+ Spec : gatewayv1.GatewaySpec {
454+ GatewayClassName : "named-ports" ,
455+ Listeners : []gatewayv1.Listener {{
456+ Name : "example-com-http" ,
457+ Port : 80 ,
458+ Protocol : gatewayv1 .HTTPProtocolType ,
459+ Hostname : PtrTo (gatewayv1 .Hostname ("example.com" )),
460+ }},
461+ },
462+ },
463+ },
464+ },
465+ HTTPRoutes : map [types.NamespacedName ]intermediate.HTTPRouteContext {
466+ {Namespace : "test" , Name : "named-ports-example-com" }: {
467+ HTTPRoute : gatewayv1.HTTPRoute {
468+ ObjectMeta : metav1.ObjectMeta {Name : "named-ports-example-com" , Namespace : "test" },
469+ Spec : gatewayv1.HTTPRouteSpec {
470+ CommonRouteSpec : gatewayv1.CommonRouteSpec {
471+ ParentRefs : []gatewayv1.ParentReference {{
472+ Name : "named-ports" ,
473+ }},
474+ },
475+ Hostnames : []gatewayv1.Hostname {"example.com" },
476+ Rules : []gatewayv1.HTTPRouteRule {{
477+ Matches : []gatewayv1.HTTPRouteMatch {{
478+ Path : & gatewayv1.HTTPPathMatch {
479+ Type : & gPathPrefix ,
480+ Value : PtrTo ("/foo" ),
481+ },
482+ }},
483+ BackendRefs : []gatewayv1.HTTPBackendRef {},
484+ }},
485+ },
486+ },
487+ RuleBackendSources : [][]intermediate.BackendSource {{}},
488+ },
489+ },
451490 },
452491 expectedErrors : field.ErrorList {field .Invalid (field .NewPath ("" ), "" , "" )},
453492 },
0 commit comments