@@ -850,6 +850,11 @@ func TestBuildGatewayStatuses(t *testing.T) {
850850 },
851851 }
852852 }
853+ createGatewayWithAddresses := func (addresses []v1.GatewaySpecAddress ) * v1.Gateway {
854+ g := createGateway ()
855+ g .Spec .Addresses = addresses
856+ return g
857+ }
853858
854859 transitionTime := helpers .PrepareTimeForFakeClient (metav1 .Now ())
855860
@@ -1341,6 +1346,105 @@ func TestBuildGatewayStatuses(t *testing.T) {
13411346 },
13421347 },
13431348 },
1349+ {
1350+ name : "valid gateway; valid listeners; gateway addresses value unspecified" ,
1351+ gateway : & graph.Gateway {
1352+ Source : createGatewayWithAddresses ([]v1.GatewaySpecAddress {
1353+ {
1354+ Type : helpers .GetPointer (v1 .IPAddressType ),
1355+ Value : "" ,
1356+ },
1357+ }),
1358+ Listeners : []* graph.Listener {
1359+ {
1360+ Name : "listener-valid-1" ,
1361+ Valid : true ,
1362+ Routes : map [graph.RouteKey ]* graph.L7Route {routeKey : {}},
1363+ },
1364+ },
1365+ Valid : true ,
1366+ },
1367+ expected : map [types.NamespacedName ]v1.GatewayStatus {
1368+ {Namespace : "test" , Name : "gateway" }: {
1369+ Addresses : addr ,
1370+ Conditions : []metav1.Condition {
1371+ {
1372+ Type : string (v1 .GatewayConditionAccepted ),
1373+ Status : metav1 .ConditionTrue ,
1374+ ObservedGeneration : 2 ,
1375+ LastTransitionTime : transitionTime ,
1376+ Reason : string (v1 .GatewayReasonAccepted ),
1377+ Message : "Gateway is accepted" ,
1378+ },
1379+ {
1380+ Type : string (v1 .GatewayConditionProgrammed ),
1381+ Status : metav1 .ConditionFalse ,
1382+ ObservedGeneration : 2 ,
1383+ LastTransitionTime : transitionTime ,
1384+ Reason : string (v1 .GatewayReasonAddressNotAssigned ),
1385+ Message : "Dynamically assigned addresses for the Gateway addresses " +
1386+ "field are not supported, value must be specified" ,
1387+ },
1388+ },
1389+ Listeners : []v1.ListenerStatus {
1390+ {
1391+ Name : "listener-valid-1" ,
1392+ AttachedRoutes : 1 ,
1393+ Conditions : validListenerConditions ,
1394+ },
1395+ },
1396+ },
1397+ },
1398+ },
1399+ {
1400+ name : "valid gateway; valid listeners; gateway addresses value unusable" ,
1401+ gateway : & graph.Gateway {
1402+ Source : createGatewayWithAddresses ([]v1.GatewaySpecAddress {
1403+ {
1404+ Type : helpers .GetPointer (v1 .IPAddressType ),
1405+ Value : "<invalid-ip>" ,
1406+ },
1407+ }),
1408+ Listeners : []* graph.Listener {
1409+ {
1410+ Name : "listener-valid-1" ,
1411+ Valid : true ,
1412+ Routes : map [graph.RouteKey ]* graph.L7Route {routeKey : {}},
1413+ },
1414+ },
1415+ Valid : true ,
1416+ },
1417+ expected : map [types.NamespacedName ]v1.GatewayStatus {
1418+ {Namespace : "test" , Name : "gateway" }: {
1419+ Addresses : addr ,
1420+ Conditions : []metav1.Condition {
1421+ {
1422+ Type : string (v1 .GatewayConditionAccepted ),
1423+ Status : metav1 .ConditionTrue ,
1424+ ObservedGeneration : 2 ,
1425+ LastTransitionTime : transitionTime ,
1426+ Reason : string (v1 .GatewayReasonAccepted ),
1427+ Message : "Gateway is accepted" ,
1428+ },
1429+ {
1430+ Type : string (v1 .GatewayConditionProgrammed ),
1431+ Status : metav1 .ConditionFalse ,
1432+ ObservedGeneration : 2 ,
1433+ LastTransitionTime : transitionTime ,
1434+ Reason : string (v1 .GatewayReasonAddressNotUsable ),
1435+ Message : "Invalid IP address" ,
1436+ },
1437+ },
1438+ Listeners : []v1.ListenerStatus {
1439+ {
1440+ Name : "listener-valid-1" ,
1441+ AttachedRoutes : 1 ,
1442+ Conditions : validListenerConditions ,
1443+ },
1444+ },
1445+ },
1446+ },
1447+ },
13441448 }
13451449
13461450 for _ , test := range tests {
0 commit comments