Skip to content

Commit 76e369a

Browse files
authored
Replace all AWS SDK calls with their WithContext analogs (#4490)
* Replace all AWS sdk calls with their WithContext analogs * Update mocks in tests
1 parent d26358f commit 76e369a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+727
-688
lines changed

controllers/awscluster_controller_test.go

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ func TestAWSClusterReconcilerIntegrationTests(t *testing.T) {
425425
}
426426

427427
func mockedDeleteSGCalls(m *mocks.MockEC2APIMockRecorder) {
428-
m.DescribeSecurityGroupsPages(gomock.Any(), gomock.Any()).Return(nil)
428+
m.DescribeSecurityGroupsPagesWithContext(context.TODO(), gomock.Any(), gomock.Any()).Return(nil)
429429
}
430430

431431
func createControllerIdentity(g *WithT) *infrav1.AWSClusterControllerIdentity {
@@ -447,7 +447,7 @@ func createControllerIdentity(g *WithT) *infrav1.AWSClusterControllerIdentity {
447447
}
448448

449449
func mockedDescribeInstanceCall(m *mocks.MockEC2APIMockRecorder) {
450-
m.DescribeInstances(gomock.Eq(&ec2.DescribeInstancesInput{
450+
m.DescribeInstancesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeInstancesInput{
451451
Filters: []*ec2.Filter{
452452
{
453453
Name: aws.String("tag:sigs.k8s.io/cluster-api-provider-aws/role"),
@@ -498,28 +498,28 @@ func mockedDescribeInstanceCall(m *mocks.MockEC2APIMockRecorder) {
498498
}
499499

500500
func mockedDeleteInstanceAndAwaitTerminationCalls(m *mocks.MockEC2APIMockRecorder) {
501-
m.TerminateInstances(
501+
m.TerminateInstancesWithContext(context.TODO(),
502502
gomock.Eq(&ec2.TerminateInstancesInput{
503503
InstanceIds: aws.StringSlice([]string{"id-1"}),
504504
}),
505505
).Return(nil, nil)
506-
m.WaitUntilInstanceTerminated(
506+
m.WaitUntilInstanceTerminatedWithContext(context.TODO(),
507507
gomock.Eq(&ec2.DescribeInstancesInput{
508508
InstanceIds: aws.StringSlice([]string{"id-1"}),
509509
}),
510510
).Return(nil)
511511
}
512512

513513
func mockedDeleteInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
514-
m.TerminateInstances(
514+
m.TerminateInstancesWithContext(context.TODO(),
515515
gomock.Eq(&ec2.TerminateInstancesInput{
516516
InstanceIds: aws.StringSlice([]string{"id-1"}),
517517
}),
518518
).Return(nil, nil)
519519
}
520520

521521
func mockedCreateVPCCalls(m *mocks.MockEC2APIMockRecorder) {
522-
m.CreateTags(gomock.Eq(&ec2.CreateTagsInput{
522+
m.CreateTagsWithContext(context.TODO(), gomock.Eq(&ec2.CreateTagsInput{
523523
Resources: aws.StringSlice([]string{"subnet-1"}),
524524
Tags: []*ec2.Tag{
525525
{
@@ -532,7 +532,7 @@ func mockedCreateVPCCalls(m *mocks.MockEC2APIMockRecorder) {
532532
},
533533
},
534534
})).Return(&ec2.CreateTagsOutput{}, nil)
535-
m.CreateTags(gomock.Eq(&ec2.CreateTagsInput{
535+
m.CreateTagsWithContext(context.TODO(), gomock.Eq(&ec2.CreateTagsInput{
536536
Resources: aws.StringSlice([]string{"subnet-2"}),
537537
Tags: []*ec2.Tag{
538538
{
@@ -545,7 +545,7 @@ func mockedCreateVPCCalls(m *mocks.MockEC2APIMockRecorder) {
545545
},
546546
},
547547
})).Return(&ec2.CreateTagsOutput{}, nil)
548-
m.DescribeSubnets(gomock.Eq(&ec2.DescribeSubnetsInput{
548+
m.DescribeSubnetsWithContext(context.TODO(), gomock.Eq(&ec2.DescribeSubnetsInput{
549549
Filters: []*ec2.Filter{
550550
{
551551
Name: aws.String("state"),
@@ -591,7 +591,7 @@ func mockedCreateVPCCalls(m *mocks.MockEC2APIMockRecorder) {
591591
},
592592
},
593593
}, nil)
594-
m.DescribeRouteTables(gomock.Eq(&ec2.DescribeRouteTablesInput{
594+
m.DescribeRouteTablesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeRouteTablesInput{
595595
Filters: []*ec2.Filter{
596596
{
597597
Name: aws.String("vpc-id"),
@@ -608,7 +608,7 @@ func mockedCreateVPCCalls(m *mocks.MockEC2APIMockRecorder) {
608608
},
609609
},
610610
}, nil)
611-
m.DescribeNatGatewaysPages(gomock.Eq(&ec2.DescribeNatGatewaysInput{
611+
m.DescribeNatGatewaysPagesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeNatGatewaysInput{
612612
Filter: []*ec2.Filter{
613613
{
614614
Name: aws.String("vpc-id"),
@@ -619,7 +619,7 @@ func mockedCreateVPCCalls(m *mocks.MockEC2APIMockRecorder) {
619619
Values: aws.StringSlice([]string{ec2.VpcStatePending, ec2.VpcStateAvailable}),
620620
},
621621
}}), gomock.Any()).Return(nil)
622-
m.DescribeVpcs(gomock.Eq(&ec2.DescribeVpcsInput{
622+
m.DescribeVpcsWithContext(context.TODO(), gomock.Eq(&ec2.DescribeVpcsInput{
623623
VpcIds: []*string{
624624
aws.String("vpc-exists"),
625625
},
@@ -652,11 +652,11 @@ func mockedCreateVPCCalls(m *mocks.MockEC2APIMockRecorder) {
652652
}
653653

654654
func mockedCreateMaximumVPCCalls(m *mocks.MockEC2APIMockRecorder) {
655-
m.CreateVpc(gomock.AssignableToTypeOf(&ec2.CreateVpcInput{})).Return(nil, errors.New("The maximum number of VPCs has been reached"))
655+
m.CreateVpcWithContext(context.TODO(), gomock.AssignableToTypeOf(&ec2.CreateVpcInput{})).Return(nil, errors.New("The maximum number of VPCs has been reached"))
656656
}
657657

658658
func mockedDeleteVPCCallsForNonExistentVPC(m *mocks.MockEC2APIMockRecorder) {
659-
m.DescribeSubnets(gomock.Eq(&ec2.DescribeSubnetsInput{
659+
m.DescribeSubnetsWithContext(context.TODO(), gomock.Eq(&ec2.DescribeSubnetsInput{
660660
Filters: []*ec2.Filter{
661661
{
662662
Name: aws.String("state"),
@@ -669,7 +669,7 @@ func mockedDeleteVPCCallsForNonExistentVPC(m *mocks.MockEC2APIMockRecorder) {
669669
}})).Return(&ec2.DescribeSubnetsOutput{
670670
Subnets: []*ec2.Subnet{},
671671
}, nil).AnyTimes()
672-
m.DescribeRouteTables(gomock.Eq(&ec2.DescribeRouteTablesInput{
672+
m.DescribeRouteTablesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeRouteTablesInput{
673673
Filters: []*ec2.Filter{{
674674
Name: aws.String("vpc-id"),
675675
Values: aws.StringSlice([]string{""}),
@@ -680,7 +680,7 @@ func mockedDeleteVPCCallsForNonExistentVPC(m *mocks.MockEC2APIMockRecorder) {
680680
},
681681
}})).Return(&ec2.DescribeRouteTablesOutput{
682682
RouteTables: []*ec2.RouteTable{}}, nil).AnyTimes()
683-
m.DescribeInternetGateways(gomock.Eq(&ec2.DescribeInternetGatewaysInput{
683+
m.DescribeInternetGatewaysWithContext(context.TODO(), gomock.Eq(&ec2.DescribeInternetGatewaysInput{
684684
Filters: []*ec2.Filter{
685685
{
686686
Name: aws.String("attachment.vpc-id"),
@@ -690,27 +690,27 @@ func mockedDeleteVPCCallsForNonExistentVPC(m *mocks.MockEC2APIMockRecorder) {
690690
})).Return(&ec2.DescribeInternetGatewaysOutput{
691691
InternetGateways: []*ec2.InternetGateway{},
692692
}, nil)
693-
m.DescribeNatGatewaysPages(gomock.Eq(&ec2.DescribeNatGatewaysInput{
693+
m.DescribeNatGatewaysPagesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeNatGatewaysInput{
694694
Filter: []*ec2.Filter{
695695
{
696696
Name: aws.String("vpc-id"),
697697
Values: []*string{aws.String("")},
698698
},
699699
},
700700
}), gomock.Any()).Return(nil).AnyTimes()
701-
m.DescribeAddresses(gomock.Eq(&ec2.DescribeAddressesInput{
701+
m.DescribeAddressesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeAddressesInput{
702702
Filters: []*ec2.Filter{
703703
{
704704
Name: aws.String("tag-key"),
705705
Values: aws.StringSlice([]string{"sigs.k8s.io/cluster-api-provider-aws/cluster/test-cluster"}),
706706
}},
707707
})).Return(nil, nil)
708-
m.DeleteVpc(gomock.AssignableToTypeOf(&ec2.DeleteVpcInput{
708+
m.DeleteVpcWithContext(context.TODO(), gomock.AssignableToTypeOf(&ec2.DeleteVpcInput{
709709
VpcId: aws.String("vpc-exists")})).Return(nil, nil)
710710
}
711711

712712
func mockedDeleteVPCCalls(m *mocks.MockEC2APIMockRecorder) {
713-
m.DescribeSubnets(gomock.Eq(&ec2.DescribeSubnetsInput{
713+
m.DescribeSubnetsWithContext(context.TODO(), gomock.Eq(&ec2.DescribeSubnetsInput{
714714
Filters: []*ec2.Filter{
715715
{
716716
Name: aws.String("state"),
@@ -731,7 +731,7 @@ func mockedDeleteVPCCalls(m *mocks.MockEC2APIMockRecorder) {
731731
},
732732
},
733733
}, nil).AnyTimes()
734-
m.DescribeRouteTables(gomock.Eq(&ec2.DescribeRouteTablesInput{
734+
m.DescribeRouteTablesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeRouteTablesInput{
735735
Filters: []*ec2.Filter{
736736
{
737737
Name: aws.String("vpc-id"),
@@ -753,10 +753,10 @@ func mockedDeleteVPCCalls(m *mocks.MockEC2APIMockRecorder) {
753753
},
754754
},
755755
}, nil).AnyTimes()
756-
m.DeleteRouteTable(gomock.Eq(&ec2.DeleteRouteTableInput{
756+
m.DeleteRouteTableWithContext(context.TODO(), gomock.Eq(&ec2.DeleteRouteTableInput{
757757
RouteTableId: aws.String("rt-12345"),
758758
}))
759-
m.DescribeInternetGateways(gomock.Eq(&ec2.DescribeInternetGatewaysInput{
759+
m.DescribeInternetGatewaysWithContext(context.TODO(), gomock.Eq(&ec2.DescribeInternetGatewaysInput{
760760
Filters: []*ec2.Filter{
761761
{
762762
Name: aws.String("attachment.vpc-id"),
@@ -771,14 +771,14 @@ func mockedDeleteVPCCalls(m *mocks.MockEC2APIMockRecorder) {
771771
},
772772
},
773773
}, nil)
774-
m.DetachInternetGateway(gomock.Eq(&ec2.DetachInternetGatewayInput{
774+
m.DetachInternetGatewayWithContext(context.TODO(), gomock.Eq(&ec2.DetachInternetGatewayInput{
775775
VpcId: aws.String("vpc-exists"),
776776
InternetGatewayId: aws.String("ig-12345"),
777777
}))
778-
m.DeleteInternetGateway(gomock.Eq(&ec2.DeleteInternetGatewayInput{
778+
m.DeleteInternetGatewayWithContext(context.TODO(), gomock.Eq(&ec2.DeleteInternetGatewayInput{
779779
InternetGatewayId: aws.String("ig-12345"),
780780
}))
781-
m.DescribeNatGatewaysPages(gomock.Eq(&ec2.DescribeNatGatewaysInput{
781+
m.DescribeNatGatewaysPagesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeNatGatewaysInput{
782782
Filter: []*ec2.Filter{
783783
{
784784
Name: aws.String("vpc-id"),
@@ -789,7 +789,7 @@ func mockedDeleteVPCCalls(m *mocks.MockEC2APIMockRecorder) {
789789
Values: aws.StringSlice([]string{ec2.VpcStatePending, ec2.VpcStateAvailable}),
790790
},
791791
}}), gomock.Any()).Return(nil).AnyTimes()
792-
m.DescribeAddresses(gomock.Eq(&ec2.DescribeAddressesInput{
792+
m.DescribeAddressesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeAddressesInput{
793793
Filters: []*ec2.Filter{
794794
{
795795
Name: aws.String("tag-key"),
@@ -804,13 +804,13 @@ func mockedDeleteVPCCalls(m *mocks.MockEC2APIMockRecorder) {
804804
},
805805
},
806806
}, nil)
807-
m.DisassociateAddress(&ec2.DisassociateAddressInput{
807+
m.DisassociateAddressWithContext(context.TODO(), &ec2.DisassociateAddressInput{
808808
AssociationId: aws.String("1234"),
809809
})
810-
m.ReleaseAddress(&ec2.ReleaseAddressInput{
810+
m.ReleaseAddressWithContext(context.TODO(), &ec2.ReleaseAddressInput{
811811
AllocationId: aws.String("1234"),
812812
})
813-
m.DescribeVpcs(gomock.Eq(&ec2.DescribeVpcsInput{
813+
m.DescribeVpcsWithContext(context.TODO(), gomock.Eq(&ec2.DescribeVpcsInput{
814814
VpcIds: []*string{
815815
aws.String("vpc-exists"),
816816
},
@@ -844,16 +844,16 @@ func mockedDeleteVPCCalls(m *mocks.MockEC2APIMockRecorder) {
844844
},
845845
},
846846
}, nil)
847-
m.DeleteSubnet(gomock.Eq(&ec2.DeleteSubnetInput{
847+
m.DeleteSubnetWithContext(context.TODO(), gomock.Eq(&ec2.DeleteSubnetInput{
848848
SubnetId: aws.String("subnet-1"),
849849
}))
850-
m.DeleteVpc(gomock.Eq(&ec2.DeleteVpcInput{
850+
m.DeleteVpcWithContext(context.TODO(), gomock.Eq(&ec2.DeleteVpcInput{
851851
VpcId: aws.String("vpc-exists"),
852852
}))
853853
}
854854

855855
func mockedCreateSGCalls(recordLBV2 bool, m *mocks.MockEC2APIMockRecorder) {
856-
m.DescribeSecurityGroups(gomock.Eq(&ec2.DescribeSecurityGroupsInput{
856+
m.DescribeSecurityGroupsWithContext(context.TODO(), gomock.Eq(&ec2.DescribeSecurityGroupsInput{
857857
Filters: []*ec2.Filter{
858858
{
859859
Name: aws.String("vpc-id"),
@@ -873,7 +873,7 @@ func mockedCreateSGCalls(recordLBV2 bool, m *mocks.MockEC2APIMockRecorder) {
873873
},
874874
},
875875
}, nil)
876-
m.CreateSecurityGroup(gomock.Eq(&ec2.CreateSecurityGroupInput{
876+
m.CreateSecurityGroupWithContext(context.TODO(), gomock.Eq(&ec2.CreateSecurityGroupInput{
877877
VpcId: aws.String("vpc-exists"),
878878
GroupName: aws.String("test-cluster-bastion"),
879879
Description: aws.String("Kubernetes cluster test-cluster: bastion"),
@@ -898,7 +898,7 @@ func mockedCreateSGCalls(recordLBV2 bool, m *mocks.MockEC2APIMockRecorder) {
898898
},
899899
})).
900900
Return(&ec2.CreateSecurityGroupOutput{GroupId: aws.String("sg-bastion")}, nil)
901-
m.CreateSecurityGroup(gomock.Eq(&ec2.CreateSecurityGroupInput{
901+
m.CreateSecurityGroupWithContext(context.TODO(), gomock.Eq(&ec2.CreateSecurityGroupInput{
902902
VpcId: aws.String("vpc-exists"),
903903
GroupName: aws.String("test-cluster-apiserver-lb"),
904904
Description: aws.String("Kubernetes cluster test-cluster: apiserver-lb"),
@@ -923,7 +923,7 @@ func mockedCreateSGCalls(recordLBV2 bool, m *mocks.MockEC2APIMockRecorder) {
923923
},
924924
})).
925925
Return(&ec2.CreateSecurityGroupOutput{GroupId: aws.String("sg-apiserver-lb")}, nil)
926-
m.CreateSecurityGroup(gomock.Eq(&ec2.CreateSecurityGroupInput{
926+
m.CreateSecurityGroupWithContext(context.TODO(), gomock.Eq(&ec2.CreateSecurityGroupInput{
927927
VpcId: aws.String("vpc-exists"),
928928
GroupName: aws.String("test-cluster-lb"),
929929
Description: aws.String("Kubernetes cluster test-cluster: lb"),
@@ -952,7 +952,7 @@ func mockedCreateSGCalls(recordLBV2 bool, m *mocks.MockEC2APIMockRecorder) {
952952
},
953953
})).
954954
Return(&ec2.CreateSecurityGroupOutput{GroupId: aws.String("sg-lb")}, nil)
955-
securityGroupControl := m.CreateSecurityGroup(gomock.Eq(&ec2.CreateSecurityGroupInput{
955+
securityGroupControl := m.CreateSecurityGroupWithContext(context.TODO(), gomock.Eq(&ec2.CreateSecurityGroupInput{
956956
VpcId: aws.String("vpc-exists"),
957957
GroupName: aws.String("test-cluster-controlplane"),
958958
Description: aws.String("Kubernetes cluster test-cluster: controlplane"),
@@ -977,7 +977,7 @@ func mockedCreateSGCalls(recordLBV2 bool, m *mocks.MockEC2APIMockRecorder) {
977977
},
978978
})).
979979
Return(&ec2.CreateSecurityGroupOutput{GroupId: aws.String("sg-controlplane")}, nil)
980-
securityGroupNode := m.CreateSecurityGroup(gomock.Eq(&ec2.CreateSecurityGroupInput{
980+
securityGroupNode := m.CreateSecurityGroupWithContext(context.TODO(), gomock.Eq(&ec2.CreateSecurityGroupInput{
981981
VpcId: aws.String("vpc-exists"),
982982
GroupName: aws.String("test-cluster-node"),
983983
Description: aws.String("Kubernetes cluster test-cluster: node"),
@@ -1002,18 +1002,18 @@ func mockedCreateSGCalls(recordLBV2 bool, m *mocks.MockEC2APIMockRecorder) {
10021002
},
10031003
})).
10041004
Return(&ec2.CreateSecurityGroupOutput{GroupId: aws.String("sg-node")}, nil)
1005-
m.AuthorizeSecurityGroupIngress(gomock.AssignableToTypeOf(&ec2.AuthorizeSecurityGroupIngressInput{
1005+
m.AuthorizeSecurityGroupIngressWithContext(context.TODO(), gomock.AssignableToTypeOf(&ec2.AuthorizeSecurityGroupIngressInput{
10061006
GroupId: aws.String("sg-controlplane"),
10071007
})).
10081008
Return(&ec2.AuthorizeSecurityGroupIngressOutput{}, nil).
10091009
After(securityGroupControl).Times(2)
1010-
m.AuthorizeSecurityGroupIngress(gomock.AssignableToTypeOf(&ec2.AuthorizeSecurityGroupIngressInput{
1010+
m.AuthorizeSecurityGroupIngressWithContext(context.TODO(), gomock.AssignableToTypeOf(&ec2.AuthorizeSecurityGroupIngressInput{
10111011
GroupId: aws.String("sg-node"),
10121012
})).
10131013
Return(&ec2.AuthorizeSecurityGroupIngressOutput{}, nil).
10141014
After(securityGroupNode).Times(2)
10151015
if recordLBV2 {
1016-
m.AuthorizeSecurityGroupIngress(gomock.AssignableToTypeOf(&ec2.AuthorizeSecurityGroupIngressInput{
1016+
m.AuthorizeSecurityGroupIngressWithContext(context.TODO(), gomock.AssignableToTypeOf(&ec2.AuthorizeSecurityGroupIngressInput{
10171017
GroupId: aws.String("sg-lb"),
10181018
})).
10191019
Return(&ec2.AuthorizeSecurityGroupIngressOutput{}, nil).

controllers/awsmachine_controller_test.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package controllers
1818

1919
import (
20+
"context"
2021
"fmt"
2122
"testing"
2223
"time"
@@ -336,7 +337,7 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
336337
expect := func(m *mocks.MockEC2APIMockRecorder, ev2 *mocks.MockELBV2APIMockRecorder, e *mocks.MockELBAPIMockRecorder) {
337338
mockedDescribeInstanceCalls(m)
338339
mockedDeleteLBCalls(false, ev2, e)
339-
m.TerminateInstances(
340+
m.TerminateInstancesWithContext(context.TODO(),
340341
gomock.Eq(&ec2.TerminateInstancesInput{
341342
InstanceIds: aws.StringSlice([]string{"id-1"}),
342343
}),
@@ -527,7 +528,7 @@ func mockedCreateSecretCall(s *mock_services.MockSecretInterfaceMockRecorder) {
527528
}
528529

529530
func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
530-
m.DescribeInstances(gomock.Eq(&ec2.DescribeInstancesInput{
531+
m.DescribeInstancesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeInstancesInput{
531532
Filters: []*ec2.Filter{
532533
{
533534
Name: aws.String("vpc-id"),
@@ -547,7 +548,7 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
547548
},
548549
},
549550
})).Return(&ec2.DescribeInstancesOutput{}, nil)
550-
m.DescribeInstanceTypes(gomock.Any()).
551+
m.DescribeInstanceTypesWithContext(context.TODO(), gomock.Any()).
551552
Return(&ec2.DescribeInstanceTypesOutput{
552553
InstanceTypes: []*ec2.InstanceTypeInfo{
553554
{
@@ -559,7 +560,7 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
559560
},
560561
},
561562
}, nil)
562-
m.DescribeImages(gomock.Eq(&ec2.DescribeImagesInput{
563+
m.DescribeImagesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeImagesInput{
563564
Filters: []*ec2.Filter{
564565
{
565566
Name: aws.String("owner-id"),
@@ -587,7 +588,7 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
587588
CreationDate: aws.String("2019-02-08T17:02:31.000Z"),
588589
},
589590
}}, nil)
590-
m.RunInstances(gomock.Any()).Return(&ec2.Reservation{
591+
m.RunInstancesWithContext(context.TODO(), gomock.Any()).Return(&ec2.Reservation{
591592
Instances: []*ec2.Instance{
592593
{
593594
State: &ec2.InstanceState{
@@ -615,7 +616,7 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
615616
},
616617
},
617618
}, nil)
618-
m.DescribeNetworkInterfaces(gomock.Eq(&ec2.DescribeNetworkInterfacesInput{Filters: []*ec2.Filter{
619+
m.DescribeNetworkInterfacesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeNetworkInterfacesInput{Filters: []*ec2.Filter{
619620
{
620621
Name: aws.String("attachment.instance-id"),
621622
Values: aws.StringSlice([]string{"two"}),
@@ -631,12 +632,12 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
631632
},
632633
},
633634
}}, nil).MaxTimes(3)
634-
m.DescribeNetworkInterfaceAttribute(gomock.Eq(&ec2.DescribeNetworkInterfaceAttributeInput{
635+
m.DescribeNetworkInterfaceAttributeWithContext(context.TODO(), gomock.Eq(&ec2.DescribeNetworkInterfaceAttributeInput{
635636
NetworkInterfaceId: aws.String("eni-1"),
636637
Attribute: aws.String("groupSet"),
637638
})).Return(&ec2.DescribeNetworkInterfaceAttributeOutput{Groups: []*ec2.GroupIdentifier{{GroupId: aws.String("3")}}}, nil).MaxTimes(1)
638-
m.ModifyNetworkInterfaceAttribute(gomock.Any()).AnyTimes()
639-
m.DescribeSubnets(gomock.Eq(&ec2.DescribeSubnetsInput{Filters: []*ec2.Filter{
639+
m.ModifyNetworkInterfaceAttributeWithContext(context.TODO(), gomock.Any()).AnyTimes()
640+
m.DescribeSubnetsWithContext(context.TODO(), gomock.Eq(&ec2.DescribeSubnetsInput{Filters: []*ec2.Filter{
640641
{
641642
Name: aws.String("state"),
642643
Values: aws.StringSlice([]string{"pending", "available"}),
@@ -657,7 +658,7 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
657658
}
658659

659660
func mockedDescribeInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
660-
m.DescribeInstances(gomock.Eq(&ec2.DescribeInstancesInput{
661+
m.DescribeInstancesWithContext(context.TODO(), gomock.Eq(&ec2.DescribeInstancesInput{
661662
InstanceIds: aws.StringSlice([]string{"myMachine"}),
662663
})).Return(&ec2.DescribeInstancesOutput{
663664
Reservations: []*ec2.Reservation{{Instances: []*ec2.Instance{{Placement: &ec2.Placement{AvailabilityZone: aws.String("us-east-1a")}, InstanceId: aws.String("id-1"), State: &ec2.InstanceState{Name: aws.String("id-1"), Code: aws.Int64(16)}}}}},

0 commit comments

Comments
 (0)