@@ -22,7 +22,6 @@ import (
22
22
23
23
"github.com/aws/aws-sdk-go/aws"
24
24
"github.com/aws/aws-sdk-go/service/ec2"
25
- "github.com/aws/aws-sdk-go/service/elb"
26
25
"github.com/golang/mock/gomock"
27
26
. "github.com/onsi/gomega"
28
27
"github.com/pkg/errors"
@@ -73,18 +72,11 @@ func TestAWSClusterReconciler_IntegrationTests(t *testing.T) {
73
72
expect := func (m * mock_ec2iface.MockEC2APIMockRecorder , e * mock_elbiface.MockELBAPIMockRecorder ) {
74
73
mockedCreateVPCCalls (m )
75
74
mockedCreateSGCalls (m )
76
- mockedCreateLBCalls (e )
75
+ mockedCreateLBCalls (t , e )
77
76
mockedDescribeInstanceCall (m )
78
77
}
79
78
expect (ec2Mock .EXPECT (), elbMock .EXPECT ())
80
79
81
- capaNS := & corev1.Namespace {
82
- ObjectMeta : metav1.ObjectMeta {
83
- Name : "capa-system" ,
84
- },
85
- }
86
- g .Expect (testEnv .Create (ctx , capaNS )).To (Succeed ())
87
-
88
80
controllerIdentity := createControllerIdentity (g )
89
81
ns , err := testEnv .CreateNamespace (ctx , fmt .Sprintf ("integ-test-%s" , util .RandomString (5 )))
90
82
g .Expect (err ).To (BeNil ())
@@ -385,47 +377,6 @@ func mockedDeleteInstanceCalls(m *mock_ec2iface.MockEC2APIMockRecorder) {
385
377
Return (nil )
386
378
}
387
379
388
- func mockedDeleteLBCalls (m * mock_elbiface.MockELBAPIMockRecorder ) {
389
- m .DescribeLoadBalancers (gomock .Eq (& elb.DescribeLoadBalancersInput {
390
- LoadBalancerNames : aws .StringSlice ([]string {"test-cluster-apiserver" }),
391
- })).
392
- Return (& elb.DescribeLoadBalancersOutput {
393
- LoadBalancerDescriptions : []* elb.LoadBalancerDescription {
394
- {
395
- Scheme : aws .String (string (infrav1 .ClassicELBSchemeInternetFacing )),
396
- Subnets : []* string {aws .String ("1" )},
397
- AvailabilityZones : []* string {aws .String ("us-east-1a" )},
398
- VPCId : aws .String ("vpc-exists" ),
399
- },
400
- },
401
- }, nil )
402
- m .DescribeLoadBalancers (gomock .Eq (& elb.DescribeLoadBalancersInput {
403
- LoadBalancerNames : aws .StringSlice ([]string {"test-cluster-apiserver" }),
404
- })).
405
- Return (& elb.DescribeLoadBalancersOutput {}, nil ).AnyTimes ()
406
- m .DescribeTags (& elb.DescribeTagsInput {LoadBalancerNames : []* string {aws .String ("test-cluster-apiserver" )}}).Return (
407
- & elb.DescribeTagsOutput {
408
- TagDescriptions : []* elb.TagDescription {
409
- {
410
- LoadBalancerName : aws .String ("test-cluster-apiserver" ),
411
- },
412
- },
413
- }, nil )
414
- m .DescribeLoadBalancerAttributes (gomock .Eq (& elb.DescribeLoadBalancerAttributesInput {
415
- LoadBalancerName : aws .String ("test-cluster-apiserver" ),
416
- })).
417
- Return (& elb.DescribeLoadBalancerAttributesOutput {
418
- LoadBalancerAttributes : & elb.LoadBalancerAttributes {
419
- CrossZoneLoadBalancing : & elb.CrossZoneLoadBalancing {
420
- Enabled : aws .Bool (false ),
421
- },
422
- },
423
- }, nil )
424
- m .DeleteLoadBalancer (gomock .Eq (& elb.DeleteLoadBalancerInput {LoadBalancerName : aws .String ("test-cluster-apiserver" )})).
425
- Return (& elb.DeleteLoadBalancerOutput {}, nil )
426
- m .DescribeLoadBalancersPages (gomock .Any (), gomock .Any ()).Return (nil ).AnyTimes ()
427
- }
428
-
429
380
func mockedCreateVPCCalls (m * mock_ec2iface.MockEC2APIMockRecorder ) {
430
381
m .CreateTags (gomock .Eq (& ec2.CreateTagsInput {
431
382
Resources : aws .StringSlice ([]string {"subnet-1" }),
@@ -950,111 +901,3 @@ func mockedCreateSGCalls(m *mock_ec2iface.MockEC2APIMockRecorder) {
950
901
Return (& ec2.AuthorizeSecurityGroupIngressOutput {}, nil ).
951
902
After (securityGroupNode ).Times (2 )
952
903
}
953
-
954
- func mockedCreateLBCalls (m * mock_elbiface.MockELBAPIMockRecorder ) {
955
- m .DescribeLoadBalancers (gomock .Eq (& elb.DescribeLoadBalancersInput {
956
- LoadBalancerNames : aws .StringSlice ([]string {"test-cluster-apiserver" }),
957
- })).
958
- Return (& elb.DescribeLoadBalancersOutput {
959
- LoadBalancerDescriptions : []* elb.LoadBalancerDescription {
960
- {
961
- Scheme : aws .String (string (infrav1 .ClassicELBSchemeInternetFacing )),
962
- Subnets : []* string {aws .String ("1" )},
963
- AvailabilityZones : []* string {aws .String ("us-east-1a" )},
964
- VPCId : aws .String ("vpc-exists" ),
965
- },
966
- },
967
- }, nil )
968
- m .DescribeLoadBalancerAttributes (gomock .Eq (& elb.DescribeLoadBalancerAttributesInput {
969
- LoadBalancerName : aws .String ("test-cluster-apiserver" ),
970
- })).
971
- Return (& elb.DescribeLoadBalancerAttributesOutput {
972
- LoadBalancerAttributes : & elb.LoadBalancerAttributes {
973
- CrossZoneLoadBalancing : & elb.CrossZoneLoadBalancing {
974
- Enabled : aws .Bool (false ),
975
- },
976
- },
977
- }, nil )
978
- m .DescribeTags (& elb.DescribeTagsInput {LoadBalancerNames : []* string {aws .String ("test-cluster-apiserver" )}}).Return (
979
- & elb.DescribeTagsOutput {
980
- TagDescriptions : []* elb.TagDescription {
981
- {
982
- LoadBalancerName : aws .String ("test-cluster-apiserver" ),
983
- Tags : []* elb.Tag {{
984
- Key : aws .String (infrav1 .ClusterTagKey ("test-cluster-apiserver" )),
985
- Value : aws .String (string (infrav1 .ResourceLifecycleOwned )),
986
- }},
987
- },
988
- },
989
- }, nil )
990
- m .ModifyLoadBalancerAttributes (gomock .Eq (& elb.ModifyLoadBalancerAttributesInput {
991
- LoadBalancerAttributes : & elb.LoadBalancerAttributes {
992
- ConnectionSettings : & elb.ConnectionSettings {IdleTimeout : aws .Int64 (600 )},
993
- CrossZoneLoadBalancing : & elb.CrossZoneLoadBalancing {Enabled : aws .Bool (false )},
994
- },
995
- LoadBalancerName : aws .String ("" ),
996
- }))
997
- m .AddTags (gomock .Eq (& elb.AddTagsInput {
998
- LoadBalancerNames : aws .StringSlice ([]string {"" }),
999
- Tags : []* elb.Tag {
1000
- {
1001
- Key : aws .String ("sigs.k8s.io/cluster-api-provider-aws/role" ),
1002
- Value : aws .String ("apiserver" ),
1003
- },
1004
- {
1005
- Key : aws .String ("Name" ),
1006
- Value : aws .String ("test-cluster-apiserver" ),
1007
- },
1008
- {
1009
- Key : aws .String ("sigs.k8s.io/cluster-api-provider-aws/cluster/test-cluster" ),
1010
- Value : aws .String ("owned" ),
1011
- },
1012
- },
1013
- })).AnyTimes ()
1014
- m .AddTags (gomock .Eq (& elb.AddTagsInput {
1015
- LoadBalancerNames : aws .StringSlice ([]string {"" }),
1016
- Tags : []* elb.Tag {
1017
- {
1018
- Key : aws .String ("sigs.k8s.io/cluster-api-provider-aws/cluster/test-cluster" ),
1019
- Value : aws .String ("owned" ),
1020
- },
1021
- {
1022
- Key : aws .String ("sigs.k8s.io/cluster-api-provider-aws/role" ),
1023
- Value : aws .String ("apiserver" ),
1024
- },
1025
- {
1026
- Key : aws .String ("Name" ),
1027
- Value : aws .String ("test-cluster-apiserver" ),
1028
- },
1029
- },
1030
- })).AnyTimes ()
1031
- m .AddTags (gomock .Eq (& elb.AddTagsInput {
1032
- LoadBalancerNames : aws .StringSlice ([]string {"" }),
1033
- Tags : []* elb.Tag {
1034
- {
1035
- Key : aws .String ("Name" ),
1036
- Value : aws .String ("test-cluster-apiserver" ),
1037
- },
1038
- {
1039
- Key : aws .String ("sigs.k8s.io/cluster-api-provider-aws/cluster/test-cluster" ),
1040
- Value : aws .String ("owned" ),
1041
- },
1042
- {
1043
- Key : aws .String ("sigs.k8s.io/cluster-api-provider-aws/role" ),
1044
- Value : aws .String ("apiserver" ),
1045
- },
1046
- },
1047
- })).AnyTimes ()
1048
- m .RemoveTags (gomock .Eq (& elb.RemoveTagsInput {
1049
- LoadBalancerNames : aws .StringSlice ([]string {"" }),
1050
- Tags : []* elb.TagKeyOnly {
1051
- {
1052
- Key : aws .String ("sigs.k8s.io/cluster-api-provider-aws/cluster/test-cluster-apiserver" ),
1053
- },
1054
- },
1055
- }))
1056
- m .ApplySecurityGroupsToLoadBalancer (gomock .Eq (& elb.ApplySecurityGroupsToLoadBalancerInput {
1057
- LoadBalancerName : aws .String ("" ),
1058
- SecurityGroups : aws .StringSlice ([]string {"sg-apiserver-lb" }),
1059
- }))
1060
- }
0 commit comments