@@ -158,6 +158,13 @@ func TestMachinePoolOwnerReference(t *testing.T) {
158
158
Replicas : ptr.To [int32 ](1 ),
159
159
ClusterName : "invalid" ,
160
160
},
161
+ Status : expv1.MachinePoolStatus {
162
+ V1Beta2 : & expv1.MachinePoolV1Beta2Status {Conditions : []metav1.Condition {{
163
+ Type : clusterv1 .PausedV1Beta2Condition ,
164
+ Status : metav1 .ConditionFalse ,
165
+ Reason : clusterv1 .NotPausedV1Beta2Reason ,
166
+ }}},
167
+ },
161
168
}
162
169
163
170
machinePoolValidCluster := & expv1.MachinePool {
@@ -176,6 +183,13 @@ func TestMachinePoolOwnerReference(t *testing.T) {
176
183
},
177
184
ClusterName : "test-cluster" ,
178
185
},
186
+ Status : expv1.MachinePoolStatus {
187
+ V1Beta2 : & expv1.MachinePoolV1Beta2Status {Conditions : []metav1.Condition {{
188
+ Type : clusterv1 .PausedV1Beta2Condition ,
189
+ Status : metav1 .ConditionFalse ,
190
+ Reason : clusterv1 .NotPausedV1Beta2Reason ,
191
+ }}},
192
+ },
179
193
}
180
194
181
195
machinePoolValidMachinePool := & expv1.MachinePool {
@@ -197,6 +211,13 @@ func TestMachinePoolOwnerReference(t *testing.T) {
197
211
},
198
212
ClusterName : "test-cluster" ,
199
213
},
214
+ Status : expv1.MachinePoolStatus {
215
+ V1Beta2 : & expv1.MachinePoolV1Beta2Status {Conditions : []metav1.Condition {{
216
+ Type : clusterv1 .PausedV1Beta2Condition ,
217
+ Status : metav1 .ConditionFalse ,
218
+ Reason : clusterv1 .NotPausedV1Beta2Reason ,
219
+ }}},
220
+ },
200
221
}
201
222
202
223
testCases := []struct {
@@ -345,6 +366,11 @@ func TestReconcileMachinePoolRequest(t *testing.T) {
345
366
{Name : "test" },
346
367
},
347
368
ObservedGeneration : 1 ,
369
+ V1Beta2 : & expv1.MachinePoolV1Beta2Status {Conditions : []metav1.Condition {{
370
+ Type : clusterv1 .PausedV1Beta2Condition ,
371
+ Status : metav1 .ConditionFalse ,
372
+ Reason : clusterv1 .NotPausedV1Beta2Reason ,
373
+ }}},
348
374
},
349
375
},
350
376
expected : expected {
@@ -390,6 +416,11 @@ func TestReconcileMachinePoolRequest(t *testing.T) {
390
416
Name : "test-node" ,
391
417
},
392
418
},
419
+ V1Beta2 : & expv1.MachinePoolV1Beta2Status {Conditions : []metav1.Condition {{
420
+ Type : clusterv1 .PausedV1Beta2Condition ,
421
+ Status : metav1 .ConditionFalse ,
422
+ Reason : clusterv1 .NotPausedV1Beta2Reason ,
423
+ }}},
393
424
},
394
425
},
395
426
nodes : []corev1.Node {
@@ -447,6 +478,11 @@ func TestReconcileMachinePoolRequest(t *testing.T) {
447
478
Name : "test-node" ,
448
479
},
449
480
},
481
+ V1Beta2 : & expv1.MachinePoolV1Beta2Status {Conditions : []metav1.Condition {{
482
+ Type : clusterv1 .PausedV1Beta2Condition ,
483
+ Status : metav1 .ConditionFalse ,
484
+ Reason : clusterv1 .NotPausedV1Beta2Reason ,
485
+ }}},
450
486
},
451
487
},
452
488
nodes : []corev1.Node {
@@ -504,6 +540,11 @@ func TestReconcileMachinePoolRequest(t *testing.T) {
504
540
Name : "test-node" ,
505
541
},
506
542
},
543
+ V1Beta2 : & expv1.MachinePoolV1Beta2Status {Conditions : []metav1.Condition {{
544
+ Type : clusterv1 .PausedV1Beta2Condition ,
545
+ Status : metav1 .ConditionFalse ,
546
+ Reason : clusterv1 .NotPausedV1Beta2Reason ,
547
+ }}},
507
548
},
508
549
},
509
550
nodes : []corev1.Node {
@@ -820,6 +861,13 @@ func TestRemoveMachinePoolFinalizerAfterDeleteReconcile(t *testing.T) {
820
861
},
821
862
},
822
863
},
864
+ Status : expv1.MachinePoolStatus {
865
+ V1Beta2 : & expv1.MachinePoolV1Beta2Status {Conditions : []metav1.Condition {{
866
+ Type : clusterv1 .PausedV1Beta2Condition ,
867
+ Status : metav1 .ConditionFalse ,
868
+ Reason : clusterv1 .NotPausedV1Beta2Reason ,
869
+ }}},
870
+ },
823
871
}
824
872
key := client.ObjectKey {Namespace : m .Namespace , Name : m .Name }
825
873
clientFake := fake .NewClientBuilder ().WithObjects (testCluster , m ).WithStatusSubresource (& expv1.MachinePool {}).Build ()
@@ -912,6 +960,13 @@ func TestMachinePoolConditions(t *testing.T) {
912
960
},
913
961
},
914
962
},
963
+ Status : expv1.MachinePoolStatus {
964
+ V1Beta2 : & expv1.MachinePoolV1Beta2Status {Conditions : []metav1.Condition {{
965
+ Type : clusterv1 .PausedV1Beta2Condition ,
966
+ Status : metav1 .ConditionFalse ,
967
+ Reason : clusterv1 .NotPausedV1Beta2Reason ,
968
+ }}},
969
+ },
915
970
}
916
971
917
972
nodeList := corev1.NodeList {
@@ -951,14 +1006,12 @@ func TestMachinePoolConditions(t *testing.T) {
951
1006
infrastructureReady : true ,
952
1007
beforeFunc : func (_ , _ * unstructured.Unstructured , mp * expv1.MachinePool , _ * corev1.NodeList ) {
953
1008
mp .Spec .ProviderIDList = []string {"azure://westus2/id-node-4" , "aws://us-east-1/id-node-1" }
954
- mp .Status = expv1.MachinePoolStatus {
955
- NodeRefs : []corev1.ObjectReference {
956
- {Name : "node-1" },
957
- {Name : "azure-node-4" },
958
- },
959
- Replicas : 2 ,
960
- ReadyReplicas : 2 ,
1009
+ mp .Status .NodeRefs = []corev1.ObjectReference {
1010
+ {Name : "node-1" },
1011
+ {Name : "azure-node-4" },
961
1012
}
1013
+ mp .Status .Replicas = 2
1014
+ mp .Status .ReadyReplicas = 2
962
1015
},
963
1016
conditionAssertFunc : func (t * testing.T , getter conditions.Getter ) {
964
1017
t .Helper ()
0 commit comments