@@ -431,69 +431,59 @@ func TestFindOldMachineSets(t *testing.T) {
431
431
msList []* clusterv1.MachineSet
432
432
reconciliationTime * metav1.Time
433
433
expected []* clusterv1.MachineSet
434
- expectedRequire []* clusterv1.MachineSet
435
434
}{
436
435
{
437
- Name : "Get old MachineSets" ,
438
- deployment : deployment ,
439
- msList : []* clusterv1.MachineSet {& newMS , & oldMS },
440
- expected : []* clusterv1.MachineSet {& oldMS },
441
- expectedRequire : nil ,
436
+ Name : "Get old MachineSets" ,
437
+ deployment : deployment ,
438
+ msList : []* clusterv1.MachineSet {& newMS , & oldMS },
439
+ expected : []* clusterv1.MachineSet {& oldMS },
442
440
},
443
441
{
444
- Name : "Get old MachineSets with no new MachineSet" ,
445
- deployment : deployment ,
446
- msList : []* clusterv1.MachineSet {& oldMS },
447
- expected : []* clusterv1.MachineSet {& oldMS },
448
- expectedRequire : nil ,
442
+ Name : "Get old MachineSets with no new MachineSet" ,
443
+ deployment : deployment ,
444
+ msList : []* clusterv1.MachineSet {& oldMS },
445
+ expected : []* clusterv1.MachineSet {& oldMS },
449
446
},
450
447
{
451
- Name : "Get old MachineSets with two new MachineSets, only the MachineSet with higher replicas is seen as new MachineSet" ,
452
- deployment : deployment ,
453
- msList : []* clusterv1.MachineSet {& oldMS , & newMS , & newMSHigherReplicas },
454
- expected : []* clusterv1.MachineSet {& oldMS , & newMS },
455
- expectedRequire : []* clusterv1.MachineSet {& newMS },
448
+ Name : "Get old MachineSets with two new MachineSets, only the MachineSet with higher replicas is seen as new MachineSet" ,
449
+ deployment : deployment ,
450
+ msList : []* clusterv1.MachineSet {& oldMS , & newMS , & newMSHigherReplicas },
451
+ expected : []* clusterv1.MachineSet {& oldMS , & newMS },
456
452
},
457
453
{
458
- Name : "Get old MachineSets with two new MachineSets, when replicas are matching only the MachineSet with lower name is seen as new MachineSet" ,
459
- deployment : deployment ,
460
- msList : []* clusterv1.MachineSet {& oldMS , & newMS , & newMSHigherName },
461
- expected : []* clusterv1.MachineSet {& oldMS , & newMSHigherName },
462
- expectedRequire : []* clusterv1.MachineSet {& newMSHigherName },
454
+ Name : "Get old MachineSets with two new MachineSets, when replicas are matching only the MachineSet with lower name is seen as new MachineSet" ,
455
+ deployment : deployment ,
456
+ msList : []* clusterv1.MachineSet {& oldMS , & newMS , & newMSHigherName },
457
+ expected : []* clusterv1.MachineSet {& oldMS , & newMSHigherName },
463
458
},
464
459
{
465
- Name : "Get empty old MachineSets" ,
466
- deployment : deployment ,
467
- msList : []* clusterv1.MachineSet {& newMS },
468
- expected : []* clusterv1.MachineSet {},
469
- expectedRequire : nil ,
460
+ Name : "Get empty old MachineSets" ,
461
+ deployment : deployment ,
462
+ msList : []* clusterv1.MachineSet {& newMS },
463
+ expected : []* clusterv1.MachineSet {},
470
464
},
471
465
{
472
466
Name : "Get old MachineSets with new MachineSets, MachineSets created before rolloutAfter are considered new when reconciliationTime < rolloutAfter" ,
473
467
deployment : deployment ,
474
468
msList : []* clusterv1.MachineSet {& msCreatedTwoBeforeRolloutAfter },
475
469
reconciliationTime : & oneBeforeRolloutAfter ,
476
470
expected : nil ,
477
- expectedRequire : nil ,
478
471
},
479
472
{
480
473
Name : "Get old MachineSets with new MachineSets, MachineSets created after rolloutAfter are considered new when reconciliationTime > rolloutAfter" ,
481
474
deployment : deployment ,
482
475
msList : []* clusterv1.MachineSet {& msCreatedTwoBeforeRolloutAfter , & msCreatedAfterRolloutAfter },
483
476
reconciliationTime : & twoAfterRolloutAfter ,
484
477
expected : []* clusterv1.MachineSet {& msCreatedTwoBeforeRolloutAfter },
485
- expectedRequire : nil ,
486
478
},
487
479
}
488
480
489
481
for _ , test := range tests {
490
482
t .Run (test .Name , func (t * testing.T ) {
491
483
g := NewWithT (t )
492
484
493
- requireMS , allMS := FindOldMachineSets (& test .deployment , test .msList , test .reconciliationTime )
485
+ allMS := FindOldMachineSets (& test .deployment , test .msList , test .reconciliationTime )
494
486
g .Expect (allMS ).To (ConsistOf (test .expected ))
495
- // MSs are getting filtered correctly by ms.spec.replicas
496
- g .Expect (requireMS ).To (ConsistOf (test .expectedRequire ))
497
487
})
498
488
}
499
489
}
0 commit comments