Skip to content

Commit be400b1

Browse files
committed
tests(ingress): remove envoloping tests
1 parent 7e75d7b commit be400b1

File tree

2 files changed

+0
-107
lines changed

2 files changed

+0
-107
lines changed

pkg/ingress/model_build_frontend_nlb_test.go

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package ingress
22

33
import (
44
"context"
5-
"sort"
65
"testing"
76

87
awssdk "github.com/aws/aws-sdk-go-v2/aws"
@@ -1602,104 +1601,3 @@ func Test_defaultModelBuildTask_getFrontendNlbAttributes(t *testing.T) {
16021601
})
16031602
}
16041603
}
1605-
1606-
func Test_defaultModelBuildTask_buildFrontendNlbAttributes(t *testing.T) {
1607-
tests := []struct {
1608-
name string
1609-
ingGroup Group
1610-
wantAttributes []elbv2model.LoadBalancerAttribute
1611-
wantErr bool
1612-
expectedErrMsg string
1613-
}{
1614-
{
1615-
name: "no attributes specified",
1616-
ingGroup: Group{
1617-
Members: []ClassifiedIngress{
1618-
{
1619-
Ing: &networking.Ingress{
1620-
ObjectMeta: metav1.ObjectMeta{
1621-
Name: "ingress1",
1622-
Namespace: "default",
1623-
},
1624-
},
1625-
},
1626-
},
1627-
},
1628-
wantAttributes: []elbv2model.LoadBalancerAttribute{},
1629-
wantErr: false,
1630-
},
1631-
{
1632-
name: "valid attributes conversion",
1633-
ingGroup: Group{
1634-
Members: []ClassifiedIngress{
1635-
{
1636-
Ing: &networking.Ingress{
1637-
ObjectMeta: metav1.ObjectMeta{
1638-
Name: "ingress1",
1639-
Namespace: "default",
1640-
Annotations: map[string]string{
1641-
"alb.ingress.kubernetes.io/frontend-nlb-attributes": "dns_record.client_routing_policy=availability_zone_affinity,cross_zone.enabled=true",
1642-
},
1643-
},
1644-
},
1645-
},
1646-
},
1647-
},
1648-
wantAttributes: []elbv2model.LoadBalancerAttribute{
1649-
{Key: "cross_zone.enabled", Value: "true"},
1650-
{Key: "dns_record.client_routing_policy", Value: "availability_zone_affinity"},
1651-
},
1652-
wantErr: false,
1653-
},
1654-
{
1655-
name: "invalid DNS policy should cause error",
1656-
ingGroup: Group{
1657-
Members: []ClassifiedIngress{
1658-
{
1659-
Ing: &networking.Ingress{
1660-
ObjectMeta: metav1.ObjectMeta{
1661-
Name: "ingress1",
1662-
Namespace: "default",
1663-
Annotations: map[string]string{
1664-
"alb.ingress.kubernetes.io/frontend-nlb-attributes": "dns_record.client_routing_policy=invalid_policy",
1665-
},
1666-
},
1667-
},
1668-
},
1669-
},
1670-
},
1671-
wantAttributes: []elbv2model.LoadBalancerAttribute{},
1672-
wantErr: true,
1673-
expectedErrMsg: "invalid dns_record.client_routing_policy set in annotation",
1674-
},
1675-
}
1676-
1677-
for _, tt := range tests {
1678-
t.Run(tt.name, func(t *testing.T) {
1679-
parser := annotations.NewSuffixAnnotationParser("alb.ingress.kubernetes.io")
1680-
task := &defaultModelBuildTask{
1681-
annotationParser: parser,
1682-
ingGroup: tt.ingGroup,
1683-
}
1684-
1685-
gotAttributes, err := task.buildFrontendNlbAttributes()
1686-
1687-
if tt.wantErr {
1688-
assert.Error(t, err)
1689-
if tt.expectedErrMsg != "" {
1690-
assert.Contains(t, err.Error(), tt.expectedErrMsg)
1691-
}
1692-
} else {
1693-
assert.NoError(t, err)
1694-
// Sort both slices to ensure stable comparison
1695-
sort.Slice(gotAttributes, func(i, j int) bool {
1696-
return gotAttributes[i].Key < gotAttributes[j].Key
1697-
})
1698-
sort.Slice(tt.wantAttributes, func(i, j int) bool {
1699-
return tt.wantAttributes[i].Key < tt.wantAttributes[j].Key
1700-
})
1701-
assert.Equal(t, tt.wantAttributes, gotAttributes)
1702-
}
1703-
})
1704-
}
1705-
}

pkg/service/model_build_load_balancer.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ import (
2626
"sigs.k8s.io/aws-load-balancer-controller/pkg/shared_utils"
2727
)
2828

29-
// Abstract this out??
30-
const (
31-
resourceIDLoadBalancer = "LoadBalancer"
32-
)
33-
3429
func (t *defaultModelBuildTask) buildLoadBalancer(ctx context.Context, scheme elbv2model.LoadBalancerScheme) error {
3530
existingLB, err := t.fetchExistingLoadBalancer(ctx)
3631
if err != nil {

0 commit comments

Comments
 (0)