@@ -408,6 +408,47 @@ func TestBuildConfiguration(t *testing.T) {
408
408
pathAndType {path : "/valid" , pathType : prefix }, pathAndType {path : invalidMatchesPath , pathType : prefix },
409
409
)
410
410
411
+ tlsTR1 := graph.L4Route {
412
+ Spec : graph.L4RouteSpec {
413
+ Hostnames : []v1.Hostname {"app.example.com" , "cafe.example.com" },
414
+ BackendRef : graph.BackendRef {
415
+ SvcNsName : types.NamespacedName {
416
+ Namespace : "default" ,
417
+ Name : "secure-app" ,
418
+ },
419
+ ServicePort : apiv1.ServicePort {
420
+ Name : "https" ,
421
+ Protocol : "TCP" ,
422
+ Port : 8443 ,
423
+ TargetPort : intstr.IntOrString {
424
+ Type : intstr .Int ,
425
+ IntVal : 8443 ,
426
+ },
427
+ },
428
+ Valid : true ,
429
+ },
430
+ },
431
+ Valid : true ,
432
+ }
433
+
434
+ tlsTR2 := graph.L4Route {
435
+ Spec : graph.L4RouteSpec {
436
+ Hostnames : []v1.Hostname {"test.example.com" },
437
+ BackendRef : graph.BackendRef {},
438
+ },
439
+ Valid : true ,
440
+ }
441
+
442
+ TR1Key := graph.L4RouteKey {NamespacedName : types.NamespacedName {
443
+ Namespace : "default" ,
444
+ Name : "secure-app" ,
445
+ }}
446
+
447
+ TR2Key := graph.L4RouteKey {NamespacedName : types.NamespacedName {
448
+ Namespace : "default" ,
449
+ Name : "secure-app2" ,
450
+ }}
451
+
411
452
httpsHR7 , expHTTPSHR7Groups , httpsRouteHR7 := createTestResources (
412
453
"https-hr-7" ,
413
454
"foo.example.com" , // same as httpsHR3
@@ -596,6 +637,13 @@ func TestBuildConfiguration(t *testing.T) {
596
637
},
597
638
}
598
639
640
+ listener443_2 := v1.Listener {
641
+ Name : "listener-443-2" ,
642
+ Hostname : (* v1 .Hostname )(helpers .GetPointer ("*.example.com" )),
643
+ Port : 443 ,
644
+ Protocol : v1 .TLSProtocolType ,
645
+ }
646
+
599
647
listener8443 := v1.Listener {
600
648
Name : "listener-8443" ,
601
649
Hostname : nil ,
@@ -1522,11 +1570,26 @@ func TestBuildConfiguration(t *testing.T) {
1522
1570
},
1523
1571
ResolvedSecret : & secret1NsName ,
1524
1572
},
1573
+ {
1574
+ Name : "listener-443-2" ,
1575
+ Source : listener443_2 ,
1576
+ Valid : true ,
1577
+ Routes : map [graph.RouteKey ]* graph.L7Route {},
1578
+ L4Routes : map [graph.L4RouteKey ]* graph.L4Route {
1579
+ TR1Key : & tlsTR1 ,
1580
+ TR2Key : & tlsTR2 ,
1581
+ },
1582
+ ResolvedSecret : & secret1NsName ,
1583
+ },
1525
1584
}... )
1526
1585
g .Routes = map [graph.RouteKey ]* graph.L7Route {
1527
1586
graph .CreateRouteKey (hr6 ): routeHR6 ,
1528
1587
graph .CreateRouteKey (httpsHR6 ): httpsRouteHR6 ,
1529
1588
}
1589
+ g .L4Routes = map [graph.L4RouteKey ]* graph.L4Route {
1590
+ TR1Key : & tlsTR1 ,
1591
+ TR2Key : & tlsTR2 ,
1592
+ }
1530
1593
g .ReferencedSecrets = map [types.NamespacedName ]* graph.Secret {
1531
1594
secret1NsName : secret1 ,
1532
1595
}
@@ -1577,6 +1640,19 @@ func TestBuildConfiguration(t *testing.T) {
1577
1640
}... )
1578
1641
conf .Upstreams = []Upstream {fooUpstream }
1579
1642
conf .BackendGroups = []BackendGroup {expHR6Groups [0 ], expHTTPSHR6Groups [0 ]}
1643
+ conf .StreamUpstreams = []Upstream {
1644
+ {
1645
+ Endpoints : fooEndpoints ,
1646
+ Name : "default_secure-app_8443" ,
1647
+ },
1648
+ }
1649
+ conf .TLSPassthroughServers = []Layer4VirtualServer {
1650
+ {
1651
+ Hostname : "app.example.com" ,
1652
+ UpstreamName : "default_secure-app_8443" ,
1653
+ Port : 443 ,
1654
+ },
1655
+ }
1580
1656
return conf
1581
1657
}),
1582
1658
msg : "one http and one https listener with routes with valid and invalid rules" ,
@@ -3217,6 +3293,7 @@ func TestGetAllowedAddressType(t *testing.T) {
3217
3293
})
3218
3294
}
3219
3295
}
3296
+
3220
3297
func TestCreatePassthroughServers (t * testing.T ) {
3221
3298
testGraph := graph.Graph {
3222
3299
Gateway : & graph.Gateway {
@@ -3409,7 +3486,7 @@ func TestBuildStreamUpstreams(t *testing.T) {
3409
3486
fakeResolver := resolverfakes.FakeServiceResolver {}
3410
3487
fakeResolver .ResolveReturns (nil , errors .New ("error" ))
3411
3488
3412
- streamUpstreams := buildStreamUpstreams (context .Background (), testGraph .Gateway .Listeners , & fakeResolver )
3489
+ streamUpstreams := buildStreamUpstreams (context .Background (), testGraph .Gateway .Listeners , & fakeResolver , Dual )
3413
3490
3414
3491
expectedStreamUpstreams := []Upstream {
3415
3492
{
0 commit comments