File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
pkg/cloud/services/autoscaling Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -323,6 +323,9 @@ func (s *Service) CanStartASGInstanceRefresh(scope *scope.MachinePoolScope) (boo
323323 describeInput := & autoscaling.DescribeInstanceRefreshesInput {AutoScalingGroupName : aws .String (scope .Name ())}
324324 refreshes , err := s .ASGClient .DescribeInstanceRefreshesWithContext (context .TODO (), describeInput )
325325 if err != nil {
326+ if awserrors .IsNotFound (err ) {
327+ return false , nil
328+ }
326329 return false , err
327330 }
328331 hasUnfinishedRefresh := false
Original file line number Diff line number Diff line change @@ -1087,6 +1087,17 @@ func TestServiceCanStartASGInstanceRefresh(t *testing.T) {
10871087 name : "should return error if describe instance refresh failed" ,
10881088 wantErr : true ,
10891089 canStart : false ,
1090+ expect : func (m * mock_autoscalingiface.MockAutoScalingAPIMockRecorder ) {
1091+ m .DescribeInstanceRefreshesWithContext (context .TODO (), gomock .Eq (& autoscaling.DescribeInstanceRefreshesInput {
1092+ AutoScalingGroupName : aws .String ("machinePoolName" ),
1093+ })).
1094+ Return (nil , awserrors .NewConflict ("some error" ))
1095+ },
1096+ },
1097+ {
1098+ name : "should NOT return error if describe instance failed due to 'not found'" ,
1099+ wantErr : false ,
1100+ canStart : false ,
10901101 expect : func (m * mock_autoscalingiface.MockAutoScalingAPIMockRecorder ) {
10911102 m .DescribeInstanceRefreshesWithContext (context .TODO (), gomock .Eq (& autoscaling.DescribeInstanceRefreshesInput {
10921103 AutoScalingGroupName : aws .String ("machinePoolName" ),
You can’t perform that action at this time.
0 commit comments