Skip to content

Commit 627e663

Browse files
committed
test(ingress): eip ne subnet
1 parent c818065 commit 627e663

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

pkg/ingress/model_build_frontend_nlb_test.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,35 @@ func Test_buildFrontendNlbSubnetMappings(t *testing.T) {
274274
{SubnetID: "subnet-2", AllocationID: awssdk.String("eip-2")},
275275
},
276276
},
277+
{
278+
name: "error when number of subnets does not match number of EIPs",
279+
fields: fields{
280+
ingGroup: Group{
281+
ID: GroupID{
282+
Namespace: "awesome-ns",
283+
Name: "my-ingress",
284+
},
285+
Members: []ClassifiedIngress{
286+
{
287+
Ing: &networking.Ingress{
288+
ObjectMeta: metav1.ObjectMeta{
289+
Namespace: "awesome-ns",
290+
Name: "ing-4",
291+
Annotations: map[string]string{
292+
"alb.ingress.kubernetes.io/frontend-nlb-subnets": "subnet-1,subnet-2,subnet-3",
293+
"alb.ingress.kubernetes.io/frontend-nlb-eip-allocations": "eip-1,eip-2",
294+
},
295+
},
296+
},
297+
},
298+
},
299+
},
300+
scheme: elbv2.LoadBalancerSchemeInternetFacing,
301+
},
302+
wantMappings: nil,
303+
wantErr: "count of EIP allocations (2) and subnets (1) must match",
304+
},
277305
}
278-
279306
for _, tt := range tests {
280307
t.Run(tt.name, func(t *testing.T) {
281308
ctrl := gomock.NewController(t)

0 commit comments

Comments
 (0)