@@ -36,10 +36,6 @@ func getNormalBackendRef() graph.BackendRef {
36
36
}
37
37
}
38
38
39
- func getModifiedBackendRef (mod func (ref graph.BackendRef ) graph.BackendRef ) graph.BackendRef {
40
- return mod (getNormalBackendRef ())
41
- }
42
-
43
39
func getExpectedConfiguration () Configuration {
44
40
return Configuration {
45
41
BaseHTTPConfig : BaseHTTPConfig {HTTP2 : true , IPFamily : Dual },
@@ -183,9 +179,7 @@ func TestBuildConfiguration(t *testing.T) {
183
179
fakeResolver := & resolverfakes.FakeServiceResolver {}
184
180
fakeResolver .ResolveReturns (fooEndpoints , nil )
185
181
186
- validBackendRef := getModifiedBackendRef (func (backend graph.BackendRef ) graph.BackendRef {
187
- return backend
188
- })
182
+ validBackendRef := getNormalBackendRef ()
189
183
190
184
expValidBackend := Backend {
191
185
UpstreamName : fooUpstreamName ,
@@ -837,14 +831,12 @@ func TestBuildConfiguration(t *testing.T) {
837
831
},
838
832
{
839
833
graph : getModifiedGraph (func (g * graph.Graph ) * graph.Graph {
840
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
841
- {
842
- Name : "invalid-listener" ,
843
- Source : invalidListener ,
844
- Valid : false ,
845
- ResolvedSecret : & secret1NsName ,
846
- },
847
- }... )
834
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
835
+ Name : "invalid-listener" ,
836
+ Source : invalidListener ,
837
+ Valid : false ,
838
+ ResolvedSecret : & secret1NsName ,
839
+ })
848
840
g .Routes = map [graph.RouteKey ]* graph.L7Route {
849
841
graph .CreateRouteKey (httpsHR1 ): httpsRouteHR1 ,
850
842
graph .CreateRouteKey (httpsHR2 ): httpsRouteHR2 ,
@@ -862,17 +854,15 @@ func TestBuildConfiguration(t *testing.T) {
862
854
},
863
855
{
864
856
graph : getModifiedGraph (func (g * graph.Graph ) * graph.Graph {
865
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
866
- {
867
- Name : "listener-80-1" ,
868
- Source : listener80 ,
869
- Valid : true ,
870
- Routes : map [graph.RouteKey ]* graph.L7Route {
871
- graph .CreateRouteKey (hr1 ): routeHR1 ,
872
- graph .CreateRouteKey (hr2 ): routeHR2 ,
873
- },
857
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
858
+ Name : "listener-80-1" ,
859
+ Source : listener80 ,
860
+ Valid : true ,
861
+ Routes : map [graph.RouteKey ]* graph.L7Route {
862
+ graph .CreateRouteKey (hr1 ): routeHR1 ,
863
+ graph .CreateRouteKey (hr2 ): routeHR2 ,
874
864
},
875
- }... )
865
+ })
876
866
g .Routes = map [graph.RouteKey ]* graph.L7Route {
877
867
graph .CreateRouteKey (hr1 ): routeHR1 ,
878
868
graph .CreateRouteKey (hr2 ): routeHR2 ,
@@ -925,16 +915,14 @@ func TestBuildConfiguration(t *testing.T) {
925
915
},
926
916
{
927
917
graph : getModifiedGraph (func (g * graph.Graph ) * graph.Graph {
928
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
929
- {
930
- Name : "listener-80-1" ,
931
- Source : listener80 ,
932
- Valid : true ,
933
- Routes : map [graph.RouteKey ]* graph.L7Route {
934
- graph .CreateRouteKey (gr ): routeGR ,
935
- },
918
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
919
+ Name : "listener-80-1" ,
920
+ Source : listener80 ,
921
+ Valid : true ,
922
+ Routes : map [graph.RouteKey ]* graph.L7Route {
923
+ graph .CreateRouteKey (gr ): routeGR ,
936
924
},
937
- }... )
925
+ })
938
926
g .Routes [graph .CreateRouteKey (gr )] = routeGR
939
927
return g
940
928
}),
@@ -1411,16 +1399,14 @@ func TestBuildConfiguration(t *testing.T) {
1411
1399
{
1412
1400
graph : getModifiedGraph (func (g * graph.Graph ) * graph.Graph {
1413
1401
g .GatewayClass .Valid = false
1414
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
1415
- {
1416
- Name : "listener-80-1" ,
1417
- Source : listener80 ,
1418
- Valid : true ,
1419
- Routes : map [graph.RouteKey ]* graph.L7Route {
1420
- graph .CreateRouteKey (hr1 ): routeHR1 ,
1421
- },
1402
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
1403
+ Name : "listener-80-1" ,
1404
+ Source : listener80 ,
1405
+ Valid : true ,
1406
+ Routes : map [graph.RouteKey ]* graph.L7Route {
1407
+ graph .CreateRouteKey (hr1 ): routeHR1 ,
1422
1408
},
1423
- }... )
1409
+ })
1424
1410
g .Routes = map [graph.RouteKey ]* graph.L7Route {
1425
1411
graph .CreateRouteKey (hr1 ): routeHR1 ,
1426
1412
}
@@ -1432,16 +1418,14 @@ func TestBuildConfiguration(t *testing.T) {
1432
1418
{
1433
1419
graph : getModifiedGraph (func (g * graph.Graph ) * graph.Graph {
1434
1420
g .GatewayClass .Valid = false
1435
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
1436
- {
1437
- Name : "listener-80-1" ,
1438
- Source : listener80 ,
1439
- Valid : true ,
1440
- Routes : map [graph.RouteKey ]* graph.L7Route {
1441
- graph .CreateRouteKey (hr1 ): routeHR1 ,
1442
- },
1421
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
1422
+ Name : "listener-80-1" ,
1423
+ Source : listener80 ,
1424
+ Valid : true ,
1425
+ Routes : map [graph.RouteKey ]* graph.L7Route {
1426
+ graph .CreateRouteKey (hr1 ): routeHR1 ,
1443
1427
},
1444
- }... )
1428
+ })
1445
1429
g .Routes = map [graph.RouteKey ]* graph.L7Route {
1446
1430
graph .CreateRouteKey (hr1 ): routeHR1 ,
1447
1431
}
@@ -1460,16 +1444,14 @@ func TestBuildConfiguration(t *testing.T) {
1460
1444
},
1461
1445
{
1462
1446
graph : getModifiedGraph (func (g * graph.Graph ) * graph.Graph {
1463
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
1464
- {
1465
- Name : "listener-80-1" ,
1466
- Source : listener80 ,
1467
- Valid : true ,
1468
- Routes : map [graph.RouteKey ]* graph.L7Route {
1469
- graph .CreateRouteKey (hr5 ): routeHR5 ,
1470
- },
1447
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
1448
+ Name : "listener-80-1" ,
1449
+ Source : listener80 ,
1450
+ Valid : true ,
1451
+ Routes : map [graph.RouteKey ]* graph.L7Route {
1452
+ graph .CreateRouteKey (hr5 ): routeHR5 ,
1471
1453
},
1472
- }... )
1454
+ })
1473
1455
g .Routes = map [graph.RouteKey ]* graph.L7Route {
1474
1456
graph .CreateRouteKey (hr5 ): routeHR5 ,
1475
1457
}
@@ -1599,16 +1581,14 @@ func TestBuildConfiguration(t *testing.T) {
1599
1581
},
1600
1582
{
1601
1583
graph : getModifiedGraph (func (g * graph.Graph ) * graph.Graph {
1602
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
1603
- {
1604
- Name : "listener-80-1" ,
1605
- Source : listener80 ,
1606
- Valid : true ,
1607
- Routes : map [graph.RouteKey ]* graph.L7Route {
1608
- graph .CreateRouteKey (hr7 ): routeHR7 ,
1609
- },
1584
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
1585
+ Name : "listener-80-1" ,
1586
+ Source : listener80 ,
1587
+ Valid : true ,
1588
+ Routes : map [graph.RouteKey ]* graph.L7Route {
1589
+ graph .CreateRouteKey (hr7 ): routeHR7 ,
1610
1590
},
1611
- }... )
1591
+ })
1612
1592
g .Routes = map [graph.RouteKey ]* graph.L7Route {
1613
1593
graph .CreateRouteKey (hr7 ): routeHR7 ,
1614
1594
}
@@ -1731,17 +1711,15 @@ func TestBuildConfiguration(t *testing.T) {
1731
1711
},
1732
1712
{
1733
1713
graph : getModifiedGraph (func (g * graph.Graph ) * graph.Graph {
1734
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
1735
- {
1736
- Name : "listener-443" ,
1737
- Source : listener443 ,
1738
- Valid : true ,
1739
- Routes : map [graph.RouteKey ]* graph.L7Route {
1740
- graph .CreateRouteKey (httpsHR8 ): httpsRouteHR8 ,
1741
- },
1742
- ResolvedSecret : & secret1NsName ,
1714
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
1715
+ Name : "listener-443" ,
1716
+ Source : listener443 ,
1717
+ Valid : true ,
1718
+ Routes : map [graph.RouteKey ]* graph.L7Route {
1719
+ graph .CreateRouteKey (httpsHR8 ): httpsRouteHR8 ,
1743
1720
},
1744
- }... )
1721
+ ResolvedSecret : & secret1NsName ,
1722
+ })
1745
1723
g .Routes = map [graph.RouteKey ]* graph.L7Route {
1746
1724
graph .CreateRouteKey (httpsHR8 ): httpsRouteHR8 ,
1747
1725
}
@@ -1792,17 +1770,15 @@ func TestBuildConfiguration(t *testing.T) {
1792
1770
},
1793
1771
{
1794
1772
graph : getModifiedGraph (func (g * graph.Graph ) * graph.Graph {
1795
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
1796
- {
1797
- Name : "listener-443" ,
1798
- Source : listener443 ,
1799
- Valid : true ,
1800
- Routes : map [graph.RouteKey ]* graph.L7Route {
1801
- graph .CreateRouteKey (httpsHR9 ): httpsRouteHR9 ,
1802
- },
1803
- ResolvedSecret : & secret1NsName ,
1773
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
1774
+ Name : "listener-443" ,
1775
+ Source : listener443 ,
1776
+ Valid : true ,
1777
+ Routes : map [graph.RouteKey ]* graph.L7Route {
1778
+ graph .CreateRouteKey (httpsHR9 ): httpsRouteHR9 ,
1804
1779
},
1805
- }... )
1780
+ ResolvedSecret : & secret1NsName ,
1781
+ })
1806
1782
g .Routes = map [graph.RouteKey ]* graph.L7Route {
1807
1783
graph .CreateRouteKey (httpsHR9 ): httpsRouteHR9 ,
1808
1784
}
@@ -1857,14 +1833,12 @@ func TestBuildConfiguration(t *testing.T) {
1857
1833
Name : "gw" ,
1858
1834
Namespace : "ns" ,
1859
1835
}
1860
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
1861
- {
1862
- Name : "listener-80-1" ,
1863
- Source : listener80 ,
1864
- Valid : true ,
1865
- Routes : map [graph.RouteKey ]* graph.L7Route {},
1866
- },
1867
- }... )
1836
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
1837
+ Name : "listener-80-1" ,
1838
+ Source : listener80 ,
1839
+ Valid : true ,
1840
+ Routes : map [graph.RouteKey ]* graph.L7Route {},
1841
+ })
1868
1842
g .NginxProxy = nginxProxy
1869
1843
return g
1870
1844
}),
@@ -1890,14 +1864,12 @@ func TestBuildConfiguration(t *testing.T) {
1890
1864
Name : "gw" ,
1891
1865
Namespace : "ns" ,
1892
1866
}
1893
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
1894
- {
1895
- Name : "listener-80-1" ,
1896
- Source : listener80 ,
1897
- Valid : true ,
1898
- Routes : map [graph.RouteKey ]* graph.L7Route {},
1899
- },
1900
- }... )
1867
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
1868
+ Name : "listener-80-1" ,
1869
+ Source : listener80 ,
1870
+ Valid : true ,
1871
+ Routes : map [graph.RouteKey ]* graph.L7Route {},
1872
+ })
1901
1873
g .NginxProxy = & graph.NginxProxy {
1902
1874
Valid : false ,
1903
1875
Source : & ngfAPI.NginxProxy {
@@ -2077,14 +2049,12 @@ func TestBuildConfiguration(t *testing.T) {
2077
2049
Name : "gw" ,
2078
2050
Namespace : "ns" ,
2079
2051
}
2080
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
2081
- {
2082
- Name : "listener-80-1" ,
2083
- Source : listener80 ,
2084
- Valid : true ,
2085
- Routes : map [graph.RouteKey ]* graph.L7Route {},
2086
- },
2087
- }... )
2052
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
2053
+ Name : "listener-80-1" ,
2054
+ Source : listener80 ,
2055
+ Valid : true ,
2056
+ Routes : map [graph.RouteKey ]* graph.L7Route {},
2057
+ })
2088
2058
g .NginxProxy = nginxProxyIPv4
2089
2059
return g
2090
2060
}),
@@ -2102,14 +2072,12 @@ func TestBuildConfiguration(t *testing.T) {
2102
2072
Name : "gw" ,
2103
2073
Namespace : "ns" ,
2104
2074
}
2105
- g .Gateway .Listeners = append (g .Gateway .Listeners , []* graph.Listener {
2106
- {
2107
- Name : "listener-80-1" ,
2108
- Source : listener80 ,
2109
- Valid : true ,
2110
- Routes : map [graph.RouteKey ]* graph.L7Route {},
2111
- },
2112
- }... )
2075
+ g .Gateway .Listeners = append (g .Gateway .Listeners , & graph.Listener {
2076
+ Name : "listener-80-1" ,
2077
+ Source : listener80 ,
2078
+ Valid : true ,
2079
+ Routes : map [graph.RouteKey ]* graph.L7Route {},
2080
+ })
2113
2081
g .NginxProxy = nginxProxyIPv6
2114
2082
return g
2115
2083
}),
0 commit comments