@@ -102,16 +102,6 @@ func TestInstanceIfExists(t *testing.T) {
102
102
},
103
103
}, nil )
104
104
105
- m .DescribeVolumes (gomock .Eq (& ec2.DescribeVolumesInput {
106
- VolumeIds : []* string {aws .String ("volume-1" )},
107
- })).Return (& ec2.DescribeVolumesOutput {
108
- Volumes : []* ec2.Volume {
109
- {
110
- VolumeId : aws .String ("volume-1" ),
111
- Size : aws .Int64 (60 ),
112
- },
113
- },
114
- }, nil )
115
105
},
116
106
check : func (instance * infrav1.Instance , err error ) {
117
107
if err != nil {
@@ -142,42 +132,6 @@ func TestInstanceIfExists(t *testing.T) {
142
132
}
143
133
},
144
134
},
145
- {
146
- name : "instance without root volume, returns error" ,
147
- instanceID : "one" ,
148
- expect : func (m * mock_ec2iface.MockEC2APIMockRecorder ) {
149
- m .DescribeInstances (& ec2.DescribeInstancesInput {
150
- InstanceIds : []* string {aws .String ("one" )},
151
- }).
152
- Return (& ec2.DescribeInstancesOutput {
153
- Reservations : []* ec2.Reservation {
154
- {
155
- Instances : []* ec2.Instance {
156
- {
157
- InstanceId : aws .String ("id-1" ),
158
- InstanceType : aws .String ("m5.large" ),
159
- SubnetId : aws .String ("subnet-1" ),
160
- ImageId : aws .String ("ami-1" ),
161
- IamInstanceProfile : & ec2.IamInstanceProfile {
162
- Arn : aws .String ("arn:aws:iam::123456789012:instance-profile/foo" ),
163
- },
164
- State : & ec2.InstanceState {
165
- Code : aws .Int64 (16 ),
166
- Name : aws .String (ec2 .StateAvailable ),
167
- },
168
- RootDeviceName : aws .String ("404-not-found" ),
169
- },
170
- },
171
- },
172
- },
173
- }, nil )
174
- },
175
- check : func (i * infrav1.Instance , err error ) {
176
- if err == nil {
177
- t .Fatalf ("expected an error but got none." )
178
- }
179
- },
180
- },
181
135
}
182
136
183
137
for _ , tc := range testCases {
@@ -394,16 +348,6 @@ func TestCreateInstance(t *testing.T) {
394
348
m .WaitUntilInstanceRunningWithContext (gomock .Any (), gomock .Any (), gomock .Any ()).
395
349
Return (nil )
396
350
397
- m .DescribeVolumes (gomock .Eq (& ec2.DescribeVolumesInput {
398
- VolumeIds : []* string {aws .String ("volume-1" )},
399
- })).Return (& ec2.DescribeVolumesOutput {
400
- Volumes : []* ec2.Volume {
401
- {
402
- VolumeId : aws .String ("volume-1" ),
403
- Size : aws .Int64 (60 ),
404
- },
405
- },
406
- }, nil )
407
351
},
408
352
check : func (instance * infrav1.Instance , err error ) {
409
353
if err != nil {
@@ -518,16 +462,6 @@ func TestCreateInstance(t *testing.T) {
518
462
m .WaitUntilInstanceRunningWithContext (gomock .Any (), gomock .Any (), gomock .Any ()).
519
463
Return (nil )
520
464
521
- m .DescribeVolumes (gomock .Eq (& ec2.DescribeVolumesInput {
522
- VolumeIds : []* string {aws .String ("volume-1" )},
523
- })).Return (& ec2.DescribeVolumesOutput {
524
- Volumes : []* ec2.Volume {
525
- {
526
- VolumeId : aws .String ("volume-1" ),
527
- Size : aws .Int64 (60 ),
528
- },
529
- },
530
- }, nil )
531
465
},
532
466
check : func (instance * infrav1.Instance , err error ) {
533
467
if err != nil {
@@ -655,16 +589,6 @@ func TestCreateInstance(t *testing.T) {
655
589
m .WaitUntilInstanceRunningWithContext (gomock .Any (), gomock .Any (), gomock .Any ()).
656
590
Return (nil )
657
591
658
- m .DescribeVolumes (gomock .Eq (& ec2.DescribeVolumesInput {
659
- VolumeIds : []* string {aws .String ("volume-1" )},
660
- })).Return (& ec2.DescribeVolumesOutput {
661
- Volumes : []* ec2.Volume {
662
- {
663
- VolumeId : aws .String ("volume-1" ),
664
- Size : aws .Int64 (60 ),
665
- },
666
- },
667
- }, nil )
668
592
},
669
593
check : func (instance * infrav1.Instance , err error ) {
670
594
if err != nil {
@@ -788,16 +712,6 @@ func TestCreateInstance(t *testing.T) {
788
712
m .WaitUntilInstanceRunningWithContext (gomock .Any (), gomock .Any (), gomock .Any ()).
789
713
Return (nil )
790
714
791
- m .DescribeVolumes (gomock .Eq (& ec2.DescribeVolumesInput {
792
- VolumeIds : []* string {aws .String ("volume-1" )},
793
- })).Return (& ec2.DescribeVolumesOutput {
794
- Volumes : []* ec2.Volume {
795
- {
796
- VolumeId : aws .String ("volume-1" ),
797
- Size : aws .Int64 (60 ),
798
- },
799
- },
800
- }, nil )
801
715
},
802
716
check : func (instance * infrav1.Instance , err error ) {
803
717
if err != nil {
@@ -922,16 +836,6 @@ func TestCreateInstance(t *testing.T) {
922
836
m .WaitUntilInstanceRunningWithContext (gomock .Any (), gomock .Any (), gomock .Any ()).
923
837
Return (nil )
924
838
925
- m .DescribeVolumes (gomock .Eq (& ec2.DescribeVolumesInput {
926
- VolumeIds : []* string {aws .String ("volume-1" )},
927
- })).Return (& ec2.DescribeVolumesOutput {
928
- Volumes : []* ec2.Volume {
929
- {
930
- VolumeId : aws .String ("volume-1" ),
931
- Size : aws .Int64 (60 ),
932
- },
933
- },
934
- }, nil )
935
839
},
936
840
check : func (instance * infrav1.Instance , err error ) {
937
841
if err != nil {
0 commit comments