Skip to content

Commit e7a6a77

Browse files
committed
tests(ingress): remove envoloping tests
1 parent d6655b0 commit e7a6a77

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

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)