Skip to content

Commit e0dfe02

Browse files
author
Valeriy Khorunzhin
committed
refactoring
Signed-off-by: Valeriy Khorunzhin <[email protected]>
1 parent 0091643 commit e0dfe02

File tree

1 file changed

+3
-4
lines changed
  • test/e2e/internal/util

1 file changed

+3
-4
lines changed

test/e2e/internal/util/vm.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,19 @@ func RebootVirtualMachineByVMOP(f *framework.Framework, vm *v1alpha2.VirtualMach
139139
}
140140

141141
func UntilVirtualMachineRebooted(key client.ObjectKey, previousRunningTime time.Time, timeout time.Duration) {
142-
vm := &v1alpha2.VirtualMachine{}
143142
Eventually(func() error {
143+
vm := &v1alpha2.VirtualMachine{}
144144
err := framework.GetClients().GenericClient().Get(context.Background(), key, vm)
145145
if err != nil {
146146
return fmt.Errorf("failed to get virtual machine: %w", err)
147147
}
148148

149149
runningCondition, _ := conditions.GetCondition(vmcondition.TypeRunning, vm.Status.Conditions)
150150

151-
if runningCondition.LastTransitionTime.Time.After(previousRunningTime) {
151+
if runningCondition.LastTransitionTime.Time.After(previousRunningTime) && vm.Status.Phase == v1alpha2.MachineRunning {
152152
return nil
153153
}
154154

155155
return fmt.Errorf("virtual machine %s is not rebooted", key.Name)
156-
}, timeout/2, time.Second).Should(Succeed())
157-
UntilObjectPhase(string(v1alpha2.MachineRunning), timeout/2, vm)
156+
}, timeout, time.Second).Should(Succeed())
158157
}

0 commit comments

Comments
 (0)