Skip to content

Commit 03f3b50

Browse files
committed
fix: add expected test calls and fix lossy conversions
1 parent 9ca0f6c commit 03f3b50

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

exp/api/v1beta1/conversion.go

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ func (src *AWSMachinePool) ConvertTo(dstRaw conversion.Hub) error {
5050
if restored.Spec.AvailabilityZoneSubnetType != nil {
5151
dst.Spec.AvailabilityZoneSubnetType = restored.Spec.AvailabilityZoneSubnetType
5252
}
53+
if restored.Spec.AWSLifecycleHooks != nil {
54+
dst.Spec.AWSLifecycleHooks = restored.Spec.AWSLifecycleHooks
55+
}
5356

5457
if restored.Spec.AWSLaunchTemplate.PrivateDNSName != nil {
5558
dst.Spec.AWSLaunchTemplate.PrivateDNSName = restored.Spec.AWSLaunchTemplate.PrivateDNSName
@@ -109,6 +112,9 @@ func (src *AWSManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error {
109112
if restored.Spec.AvailabilityZoneSubnetType != nil {
110113
dst.Spec.AvailabilityZoneSubnetType = restored.Spec.AvailabilityZoneSubnetType
111114
}
115+
if restored.Spec.AWSLifecycleHooks != nil {
116+
dst.Spec.AWSLifecycleHooks = restored.Spec.AWSLifecycleHooks
117+
}
112118

113119
return nil
114120
}

exp/controllers/awsmachinepool_controller_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ func TestAWSMachinePoolReconciler(t *testing.T) {
323323
setSuspendedProcesses(t, g)
324324
ms.AWSMachinePool.Spec.SuspendProcesses.All = true
325325
reconSvc.EXPECT().ReconcileLaunchTemplate(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
326+
reconSvc.EXPECT().ReconcileLifecycleHooks(gomock.Any()).Return(nil)
326327
reconSvc.EXPECT().ReconcileTags(gomock.Any(), gomock.Any()).Return(nil)
327328
asgSvc.EXPECT().GetASGByName(gomock.Any()).Return(&expinfrav1.AutoScalingGroup{
328329
Name: "name",
@@ -363,6 +364,7 @@ func TestAWSMachinePoolReconciler(t *testing.T) {
363364
setSuspendedProcesses(t, g)
364365

365366
reconSvc.EXPECT().ReconcileLaunchTemplate(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
367+
reconSvc.EXPECT().ReconcileLifecycleHooks(gomock.Any()).Return(nil)
366368
reconSvc.EXPECT().ReconcileTags(gomock.Any(), gomock.Any()).Return(nil)
367369
asgSvc.EXPECT().GetASGByName(gomock.Any()).Return(&expinfrav1.AutoScalingGroup{
368370
Name: "name",
@@ -388,6 +390,7 @@ func TestAWSMachinePoolReconciler(t *testing.T) {
388390
DesiredCapacity: ptr.To[int32](1),
389391
}
390392
reconSvc.EXPECT().ReconcileLaunchTemplate(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
393+
reconSvc.EXPECT().ReconcileLifecycleHooks(gomock.Any()).Return(nil)
391394
asgSvc.EXPECT().GetASGByName(gomock.Any()).Return(&asg, nil)
392395
asgSvc.EXPECT().SubnetIDs(gomock.Any()).Return([]string{}, nil)
393396
asgSvc.EXPECT().UpdateASG(gomock.Any()).Return(nil)
@@ -426,6 +429,7 @@ func TestAWSMachinePoolReconciler(t *testing.T) {
426429
},
427430
Subnets: []string{"subnet1", "subnet2"}}
428431
reconSvc.EXPECT().ReconcileLaunchTemplate(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
432+
reconSvc.EXPECT().ReconcileLifecycleHooks(gomock.Any()).Return(nil)
429433
reconSvc.EXPECT().ReconcileTags(gomock.Any(), gomock.Any()).Return(nil)
430434
asgSvc.EXPECT().GetASGByName(gomock.Any()).Return(&asg, nil).AnyTimes()
431435
asgSvc.EXPECT().SubnetIDs(gomock.Any()).Return([]string{"subnet2", "subnet1"}, nil).Times(1)
@@ -444,6 +448,7 @@ func TestAWSMachinePoolReconciler(t *testing.T) {
444448
MaxSize: int32(100),
445449
Subnets: []string{"subnet1", "subnet2"}}
446450
reconSvc.EXPECT().ReconcileLaunchTemplate(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
451+
reconSvc.EXPECT().ReconcileLifecycleHooks(gomock.Any()).Return(nil)
447452
reconSvc.EXPECT().ReconcileTags(gomock.Any(), gomock.Any()).Return(nil)
448453
asgSvc.EXPECT().GetASGByName(gomock.Any()).Return(&asg, nil).AnyTimes()
449454
asgSvc.EXPECT().SubnetIDs(gomock.Any()).Return([]string{"subnet1"}, nil).Times(1)
@@ -462,6 +467,7 @@ func TestAWSMachinePoolReconciler(t *testing.T) {
462467
MaxSize: int32(2),
463468
Subnets: []string{}}
464469
reconSvc.EXPECT().ReconcileLaunchTemplate(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
470+
reconSvc.EXPECT().ReconcileLifecycleHooks(gomock.Any()).Return(nil)
465471
reconSvc.EXPECT().ReconcileTags(gomock.Any(), gomock.Any()).Return(nil)
466472
asgSvc.EXPECT().GetASGByName(gomock.Any()).Return(&asg, nil).AnyTimes()
467473
asgSvc.EXPECT().SubnetIDs(gomock.Any()).Return([]string{}, nil).Times(1)

0 commit comments

Comments
 (0)