@@ -445,7 +445,7 @@ var _ = Describe("LifecycleHandler", func() {
445445 ),
446446 )
447447
448- DescribeTable ("should map progress by reason" , func (reason vmopcondition.ReasonCompleted , initial * int32 , expected int32 ) {
448+ DescribeTable ("should map progress by reason" , func (reason vmopcondition.ReasonCompleted , initial string , expected int32 ) {
449449 h := LifecycleHandler {progressStrategy : & progressStrategyStub {value : 55 }}
450450 vmop := & v1alpha2.VirtualMachineOperation {Status : v1alpha2.VirtualMachineOperationStatus {Progress : initial }}
451451 mig := & virtv1.VirtualMachineInstanceMigration {}
@@ -461,14 +461,14 @@ var _ = Describe("LifecycleHandler", func() {
461461 Entry ("source suspended" , vmopcondition .ReasonSourceSuspended , nil , int32 (91 )),
462462 Entry ("target resumed" , vmopcondition .ReasonTargetResumed , nil , int32 (92 )),
463463 Entry ("migration completed" , vmopcondition .ReasonMigrationCompleted , nil , int32 (100 )),
464- Entry ("unknown keeps existing progress" , vmopcondition .ReasonFailed , ptr. To [ int32 ]( 44 ) , int32 (44 )),
464+ Entry ("unknown keeps existing progress" , vmopcondition .ReasonFailed , "44%" , int32 (44 )),
465465 )
466466
467467 It ("should set syncing progress inside [10,90] for running migration" , func () {
468468 vm := newVM (v1alpha2 .PreferSafeMigrationPolicy )
469469 vmop := newVMOPMigrate ()
470470 vmop .Status .Phase = v1alpha2 .VMOPPhaseInProgress
471- vmop .Status .Progress = ptr. To [ int32 ]( 10 )
471+ vmop .Status .Progress = "10%"
472472
473473 mig := newSimpleMigration (fmt .Sprintf ("vmop-%s" , vmop .Name ), name )
474474 mig .Status .Phase = virtv1 .MigrationRunning
@@ -484,9 +484,9 @@ var _ = Describe("LifecycleHandler", func() {
484484 _ , err := h .Handle (ctx , srv .Changed ())
485485 Expect (err ).NotTo (HaveOccurred ())
486486 Expect (srv .Changed ().Status .Phase ).To (Equal (v1alpha2 .VMOPPhaseInProgress ))
487- Expect (srv .Changed ().Status .Progress ).NotTo (BeNil ())
488- Expect (* srv .Changed ().Status .Progress ).To (BeNumerically (">=" , migrationprogress .SyncRangeMin ))
489- Expect (* srv .Changed ().Status .Progress ).To (BeNumerically ("<=" , migrationprogress .SyncRangeMax ))
487+ Expect (srv .Changed ().Status .Progress ).NotTo (BeEmpty ())
488+ Expect (migrationprogress . ParsePercent ( srv .Changed ().Status .Progress ) ).To (BeNumerically (">=" , migrationprogress .SyncRangeMin ))
489+ Expect (migrationprogress . ParsePercent ( srv .Changed ().Status .Progress ) ).To (BeNumerically ("<=" , migrationprogress .SyncRangeMax ))
490490
491491 completed , found := conditions .GetCondition (vmopcondition .TypeCompleted , srv .Changed ().Status .Conditions )
492492 Expect (found ).To (BeTrue ())
@@ -509,15 +509,14 @@ var _ = Describe("LifecycleHandler", func() {
509509 _ , err := h .Handle (ctx , srv .Changed ())
510510 Expect (err ).NotTo (HaveOccurred ())
511511 Expect (srv .Changed ().Status .Phase ).To (Equal (v1alpha2 .VMOPPhasePending ))
512- Expect (srv .Changed ().Status .Progress ).NotTo (BeNil ())
513- Expect (* srv .Changed ().Status .Progress ).To (Equal (int32 (2 )))
512+ Expect (srv .Changed ().Status .Progress ).To (Equal ("2%" ))
514513 })
515514
516515 It ("should set aborted reason and preserve progress for failed migration" , func () {
517516 vm := newVM (v1alpha2 .PreferSafeMigrationPolicy )
518517 vmop := newVMOPMigrate ()
519518 vmop .Status .Phase = v1alpha2 .VMOPPhaseInProgress
520- vmop .Status .Progress = ptr. To [ int32 ]( 55 )
519+ vmop .Status .Progress = "55%"
521520
522521 mig := newSimpleMigration (fmt .Sprintf ("vmop-%s" , vmop .Name ), name )
523522 mig .Status .Phase = virtv1 .MigrationFailed
@@ -531,8 +530,7 @@ var _ = Describe("LifecycleHandler", func() {
531530 _ , err := h .Handle (ctx , srv .Changed ())
532531 Expect (err ).NotTo (HaveOccurred ())
533532 Expect (srv .Changed ().Status .Phase ).To (Equal (v1alpha2 .VMOPPhaseFailed ))
534- Expect (srv .Changed ().Status .Progress ).NotTo (BeNil ())
535- Expect (* srv .Changed ().Status .Progress ).To (Equal (int32 (55 )))
533+ Expect (srv .Changed ().Status .Progress ).To (Equal ("55%" ))
536534
537535 completed , found := conditions .GetCondition (vmopcondition .TypeCompleted , srv .Changed ().Status .Conditions )
538536 Expect (found ).To (BeTrue ())
@@ -555,15 +553,14 @@ var _ = Describe("LifecycleHandler", func() {
555553 _ , err := h .Handle (ctx , srv .Changed ())
556554 Expect (err ).NotTo (HaveOccurred ())
557555 Expect (srv .Changed ().Status .Phase ).To (Equal (v1alpha2 .VMOPPhaseCompleted ))
558- Expect (srv .Changed ().Status .Progress ).NotTo (BeNil ())
559- Expect (* srv .Changed ().Status .Progress ).To (Equal (int32 (100 )))
556+ Expect (srv .Changed ().Status .Progress ).To (Equal ("100%" ))
560557 })
561558
562559 It ("should override Syncing with NotConverging when strategy detects stall" , func () {
563560 vm := newVM (v1alpha2 .PreferSafeMigrationPolicy )
564561 vmop := newVMOPMigrate ()
565562 vmop .Status .Phase = v1alpha2 .VMOPPhaseInProgress
566- vmop .Status .Progress = ptr. To [ int32 ]( 50 )
563+ vmop .Status .Progress = "50%"
567564
568565 mig := newSimpleMigration (fmt .Sprintf ("vmop-%s" , vmop .Name ), name )
569566 mig .Status .Phase = virtv1 .MigrationRunning
@@ -592,7 +589,7 @@ var _ = Describe("LifecycleHandler", func() {
592589 vm := newVM (v1alpha2 .PreferSafeMigrationPolicy )
593590 vmop := newVMOPMigrate ()
594591 vmop .Status .Phase = v1alpha2 .VMOPPhaseInProgress
595- vmop .Status .Progress = ptr. To [ int32 ]( 30 )
592+ vmop .Status .Progress = "30%"
596593
597594 mig := newSimpleMigration (fmt .Sprintf ("vmop-%s" , vmop .Name ), name )
598595 mig .Status .Phase = virtv1 .MigrationRunning
@@ -691,8 +688,7 @@ var _ = Describe("LifecycleHandler", func() {
691688
692689 _ , err := h .Handle (ctx , srv .Changed ())
693690 Expect (err ).NotTo (HaveOccurred ())
694- Expect (srv .Changed ().Status .Progress ).NotTo (BeNil ())
695- Expect (* srv .Changed ().Status .Progress ).To (Equal (int32 (3 )))
691+ Expect (srv .Changed ().Status .Progress ).To (Equal ("3%" ))
696692
697693 completed , found := conditions .GetCondition (vmopcondition .TypeCompleted , srv .Changed ().Status .Conditions )
698694 Expect (found ).To (BeTrue ())
@@ -717,8 +713,7 @@ var _ = Describe("LifecycleHandler", func() {
717713
718714 _ , err := h .Handle (ctx , srv .Changed ())
719715 Expect (err ).NotTo (HaveOccurred ())
720- Expect (srv .Changed ().Status .Progress ).NotTo (BeNil ())
721- Expect (* srv .Changed ().Status .Progress ).To (Equal (int32 (92 )))
716+ Expect (srv .Changed ().Status .Progress ).To (Equal ("92%" ))
722717
723718 completed , found := conditions .GetCondition (vmopcondition .TypeCompleted , srv .Changed ().Status .Conditions )
724719 Expect (found ).To (BeTrue ())
@@ -744,8 +739,7 @@ var _ = Describe("LifecycleHandler", func() {
744739
745740 _ , err := h .Handle (ctx , srv .Changed ())
746741 Expect (err ).NotTo (HaveOccurred ())
747- Expect (srv .Changed ().Status .Progress ).NotTo (BeNil ())
748- Expect (* srv .Changed ().Status .Progress ).To (Equal (int32 (91 )))
742+ Expect (srv .Changed ().Status .Progress ).To (Equal ("91%" ))
749743
750744 completed , found := conditions .GetCondition (vmopcondition .TypeCompleted , srv .Changed ().Status .Conditions )
751745 Expect (found ).To (BeTrue ())
@@ -756,7 +750,7 @@ var _ = Describe("LifecycleHandler", func() {
756750 vm := newVM (v1alpha2 .PreferSafeMigrationPolicy )
757751 vmop := newVMOPMigrate ()
758752 vmop .Status .Phase = v1alpha2 .VMOPPhaseInProgress
759- vmop .Status .Progress = ptr. To [ int32 ]( 60 )
753+ vmop .Status .Progress = "60%"
760754 vmop .Status .Conditions = []metav1.Condition {
761755 {
762756 Type : vmopcondition .TypeSignalSent .String (),
@@ -791,7 +785,7 @@ var _ = Describe("LifecycleHandler", func() {
791785 vm := newVM (v1alpha2 .PreferSafeMigrationPolicy )
792786 vmop := newVMOPMigrate ()
793787 vmop .Status .Phase = v1alpha2 .VMOPPhaseInProgress
794- vmop .Status .Progress = ptr. To [ int32 ]( 60 )
788+ vmop .Status .Progress = "60%"
795789 vmop .Status .Conditions = []metav1.Condition {
796790 {
797791 Type : vmopcondition .TypeSignalSent .String (),
0 commit comments