@@ -3,6 +3,10 @@ package service
3
3
import (
4
4
"context"
5
5
"errors"
6
+ "sort"
7
+ "strconv"
8
+ "testing"
9
+
6
10
"github.com/aws/aws-sdk-go/aws"
7
11
"github.com/aws/aws-sdk-go/service/ec2"
8
12
"github.com/stretchr/testify/assert"
@@ -12,9 +16,6 @@ import (
12
16
elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1"
13
17
"sigs.k8s.io/aws-load-balancer-controller/pkg/annotations"
14
18
"sigs.k8s.io/aws-load-balancer-controller/pkg/model/elbv2"
15
- "sort"
16
- "strconv"
17
- "testing"
18
19
)
19
20
20
21
func Test_defaultModelBuilderTask_targetGroupAttrs (t * testing.T ) {
@@ -1044,6 +1045,21 @@ func Test_defaultModelBuilder_buildTargetType(t *testing.T) {
1044
1045
},
1045
1046
wantErr : errors .New ("unsupported target type \" unknown\" for load balancer type \" external\" " ),
1046
1047
},
1048
+ {
1049
+ testName : "external, ClusterIP with target type instance" ,
1050
+ svc : & corev1.Service {
1051
+ ObjectMeta : metav1.ObjectMeta {
1052
+ Annotations : map [string ]string {
1053
+ "service.beta.kubernetes.io/aws-load-balancer-type" : "external" ,
1054
+ "service.beta.kubernetes.io/aws-load-balancer-nlb-target-type" : "instance" ,
1055
+ },
1056
+ },
1057
+ Spec : corev1.ServiceSpec {
1058
+ Type : corev1 .ServiceTypeClusterIP ,
1059
+ },
1060
+ },
1061
+ wantErr : errors .New ("unsupported service type \" ClusterIP\" for load balancer target type \" instance\" " ),
1062
+ },
1047
1063
}
1048
1064
for _ , tt := range tests {
1049
1065
t .Run (tt .testName , func (t * testing.T ) {
0 commit comments