@@ -430,7 +430,7 @@ func newTestMachineDeployment(pds *int32, replicas, statusReplicas, updatedRepli
430
430
}
431
431
432
432
// helper to create MS with given availableReplicas.
433
- func newTestMachinesetWithReplicas (name string , specReplicas , statusReplicas , availableReplicas int32 ) * clusterv1.MachineSet {
433
+ func newTestMachinesetWithReplicas (name string , specReplicas , statusReplicas , availableReplicas int32 , conditions clusterv1. Conditions ) * clusterv1.MachineSet {
434
434
return & clusterv1.MachineSet {
435
435
ObjectMeta : metav1.ObjectMeta {
436
436
Name : name ,
@@ -443,6 +443,7 @@ func newTestMachinesetWithReplicas(name string, specReplicas, statusReplicas, av
443
443
Status : clusterv1.MachineSetStatus {
444
444
AvailableReplicas : availableReplicas ,
445
445
Replicas : statusReplicas ,
446
+ Conditions : conditions ,
446
447
},
447
448
}
448
449
}
@@ -460,7 +461,7 @@ func TestSyncDeploymentStatus(t *testing.T) {
460
461
name : "Deployment not available: MachineDeploymentAvailableCondition should exist and be false" ,
461
462
d : newTestMachineDeployment (& pds , 3 , 2 , 2 , 2 , clusterv1.Conditions {}),
462
463
oldMachineSets : []* clusterv1.MachineSet {},
463
- newMachineSet : newTestMachinesetWithReplicas ("foo" , 3 , 2 , 2 ),
464
+ newMachineSet : newTestMachinesetWithReplicas ("foo" , 3 , 2 , 2 , clusterv1. Conditions {} ),
464
465
expectedConditions : []* clusterv1.Condition {
465
466
{
466
467
Type : clusterv1 .MachineDeploymentAvailableCondition ,
@@ -474,14 +475,49 @@ func TestSyncDeploymentStatus(t *testing.T) {
474
475
name : "Deployment Available: MachineDeploymentAvailableCondition should exist and be true" ,
475
476
d : newTestMachineDeployment (& pds , 3 , 3 , 3 , 3 , clusterv1.Conditions {}),
476
477
oldMachineSets : []* clusterv1.MachineSet {},
477
- newMachineSet : newTestMachinesetWithReplicas ("foo" , 3 , 3 , 3 ),
478
+ newMachineSet : newTestMachinesetWithReplicas ("foo" , 3 , 3 , 3 , clusterv1. Conditions {} ),
478
479
expectedConditions : []* clusterv1.Condition {
479
480
{
480
481
Type : clusterv1 .MachineDeploymentAvailableCondition ,
481
482
Status : corev1 .ConditionTrue ,
482
483
},
483
484
},
484
485
},
486
+ {
487
+ name : "MachineSet exist: MachineSetReadyCondition should exist and mirror MachineSet Ready condition" ,
488
+ d : newTestMachineDeployment (& pds , 3 , 3 , 3 , 3 , clusterv1.Conditions {}),
489
+ oldMachineSets : []* clusterv1.MachineSet {},
490
+ newMachineSet : newTestMachinesetWithReplicas ("foo" , 3 , 3 , 3 , clusterv1.Conditions {
491
+ {
492
+ Type : clusterv1 .ReadyCondition ,
493
+ Status : corev1 .ConditionFalse ,
494
+ Reason : "TestErrorResaon" ,
495
+ Message : "test error messsage" ,
496
+ },
497
+ }),
498
+ expectedConditions : []* clusterv1.Condition {
499
+ {
500
+ Type : clusterv1 .MachineSetReadyCondition ,
501
+ Status : corev1 .ConditionFalse ,
502
+ Reason : "TestErrorResaon" ,
503
+ Message : "test error messsage" ,
504
+ },
505
+ },
506
+ },
507
+ {
508
+ name : "MachineSet doesn't exist: MachineSetReadyCondition should exist and be false" ,
509
+ d : newTestMachineDeployment (& pds , 3 , 3 , 3 , 3 , clusterv1.Conditions {}),
510
+ oldMachineSets : []* clusterv1.MachineSet {},
511
+ newMachineSet : nil ,
512
+ expectedConditions : []* clusterv1.Condition {
513
+ {
514
+ Type : clusterv1 .MachineSetReadyCondition ,
515
+ Status : corev1 .ConditionFalse ,
516
+ Severity : clusterv1 .ConditionSeverityInfo ,
517
+ Reason : clusterv1 .WaitingForMachineSetFallbackReason ,
518
+ },
519
+ },
520
+ },
485
521
}
486
522
487
523
for _ , test := range tests {
0 commit comments