@@ -20,7 +20,6 @@ import (
2020	"testing" 
2121
2222	. "github.com/onsi/gomega" 
23- 	"k8s.io/utils/ptr" 
2423)
2524
2625func  TestAzureManagedControlPlane_SetDefaultSSHPublicKey (t  * testing.T ) {
@@ -54,87 +53,3 @@ func hardcodedAzureManagedControlPlaneWithSSHKey(sshPublicKey string) *AzureMana
5453		},
5554	}
5655}
57- 
58- func  TestSetDefaultAutoScalerProfile (t  * testing.T ) {
59- 	g  :=  NewWithT (t )
60- 
61- 	type  test  struct  {
62- 		amcp  * AzureManagedControlPlane 
63- 	}
64- 
65- 	defaultAMP  :=  & AzureManagedControlPlane {
66- 		Spec : AzureManagedControlPlaneSpec {
67- 			AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
68- 				AutoScalerProfile : & AutoScalerProfile {
69- 					BalanceSimilarNodeGroups :      (* BalanceSimilarNodeGroups )(ptr .To (string (BalanceSimilarNodeGroupsFalse ))),
70- 					Expander :                      (* Expander )(ptr .To (string (ExpanderRandom ))),
71- 					MaxEmptyBulkDelete :            ptr .To ("10" ),
72- 					MaxGracefulTerminationSec :     ptr .To ("600" ),
73- 					MaxNodeProvisionTime :          ptr .To ("15m" ),
74- 					MaxTotalUnreadyPercentage :     ptr .To ("45" ),
75- 					NewPodScaleUpDelay :            ptr .To ("0s" ),
76- 					OkTotalUnreadyCount :           ptr .To ("3" ),
77- 					ScanInterval :                  ptr .To ("10s" ),
78- 					ScaleDownDelayAfterAdd :        ptr .To ("10m" ),
79- 					ScaleDownDelayAfterDelete :     ptr .To ("10s" ),
80- 					ScaleDownDelayAfterFailure :    ptr .To ("3m" ),
81- 					ScaleDownUnneededTime :         ptr .To ("10m" ),
82- 					ScaleDownUnreadyTime :          ptr .To ("20m" ),
83- 					ScaleDownUtilizationThreshold : ptr .To ("0.5" ),
84- 					SkipNodesWithLocalStorage :     (* SkipNodesWithLocalStorage )(ptr .To (string (SkipNodesWithLocalStorageFalse ))),
85- 					SkipNodesWithSystemPods :       (* SkipNodesWithSystemPods )(ptr .To (string (SkipNodesWithSystemPodsTrue ))),
86- 				},
87- 			},
88- 		},
89- 	}
90- 
91- 	allFieldsAreNilTest  :=  test {amcp : & AzureManagedControlPlane {
92- 		Spec : AzureManagedControlPlaneSpec {
93- 			AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
94- 				AutoScalerProfile : & AutoScalerProfile {},
95- 			},
96- 		},
97- 	}}
98- 
99- 	allFieldsAreNilTest .amcp .Spec .AutoScalerProfile  =  setDefaultAutoScalerProfile (allFieldsAreNilTest .amcp .Spec .AutoScalerProfile )
100- 
101- 	g .Expect (allFieldsAreNilTest .amcp .Spec .AutoScalerProfile ).To (Equal (defaultAMP .Spec .AutoScalerProfile ))
102- 
103- 	expectedNotNil  :=  & AzureManagedControlPlane {
104- 		Spec : AzureManagedControlPlaneSpec {
105- 			AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
106- 				AutoScalerProfile : & AutoScalerProfile {
107- 					BalanceSimilarNodeGroups :      (* BalanceSimilarNodeGroups )(ptr .To (string (BalanceSimilarNodeGroupsTrue ))),
108- 					Expander :                      (* Expander )(ptr .To (string (ExpanderLeastWaste ))),
109- 					MaxEmptyBulkDelete :            ptr .To ("5" ),
110- 					MaxGracefulTerminationSec :     ptr .To ("300" ),
111- 					MaxNodeProvisionTime :          ptr .To ("10m" ),
112- 					MaxTotalUnreadyPercentage :     ptr .To ("30" ),
113- 					NewPodScaleUpDelay :            ptr .To ("30s" ),
114- 					OkTotalUnreadyCount :           ptr .To ("5" ),
115- 					ScanInterval :                  ptr .To ("20s" ),
116- 					ScaleDownDelayAfterAdd :        ptr .To ("5m" ),
117- 					ScaleDownDelayAfterDelete :     ptr .To ("1m" ),
118- 					ScaleDownDelayAfterFailure :    ptr .To ("2m" ),
119- 					ScaleDownUnneededTime :         ptr .To ("5m" ),
120- 					ScaleDownUnreadyTime :          ptr .To ("10m" ),
121- 					ScaleDownUtilizationThreshold : ptr .To ("0.4" ),
122- 					SkipNodesWithLocalStorage :     (* SkipNodesWithLocalStorage )(ptr .To (string (SkipNodesWithLocalStorageTrue ))),
123- 					SkipNodesWithSystemPods :       (* SkipNodesWithSystemPods )(ptr .To (string (SkipNodesWithSystemPodsFalse ))),
124- 				},
125- 			},
126- 		},
127- 	}
128- 
129- 	allFieldsAreNotNilTest  :=  test {amcp : & AzureManagedControlPlane {
130- 		Spec : AzureManagedControlPlaneSpec {
131- 			AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
132- 				AutoScalerProfile : ptr .To (* expectedNotNil .Spec .AutoScalerProfile ),
133- 			},
134- 		},
135- 	}}
136- 
137- 	allFieldsAreNotNilTest .amcp .Spec .AutoScalerProfile  =  setDefaultAutoScalerProfile (allFieldsAreNotNilTest .amcp .Spec .AutoScalerProfile )
138- 
139- 	g .Expect (allFieldsAreNotNilTest .amcp .Spec .AutoScalerProfile ).To (Equal (expectedNotNil .Spec .AutoScalerProfile ))
140- }
0 commit comments