Skip to content

Commit 9baa163

Browse files
authored
fix(test): affinity phase fail (#1615)
Description Change type of checks for VM migration. Don't try to wait Migrating phase, just wait migration status. Thats approach more more stable, than trying to catch phase. --------- Signed-off-by: Daniil Antoshin <[email protected]>
1 parent 9d1b28e commit 9baa163

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

tests/e2e/affinity_toleration_test.go

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,15 @@ var _ = Describe("VirtualMachineAffinityAndToleration", framework.CommonE2ETestD
169169
if err != nil {
170170
return err
171171
}
172-
if updatedVMObjC.Status.Phase != v1alpha2.MachineMigrating {
173-
return fmt.Errorf("the `VirtualMachine` should be %s", v1alpha2.MachineMigrating)
172+
173+
if updatedVMObjC.Status.MigrationState == nil {
174+
return errors.New("the `VirtualMachine` should be migrated")
175+
}
176+
177+
if updatedVMObjC.Status.MigrationState.Result != v1alpha2.MigrationResultSucceeded {
178+
return fmt.Errorf("the `VirtualMachine` should migrate to %q", vmObjA.Status.Node)
174179
}
180+
175181
return nil
176182
}).WithTimeout(LongWaitDuration).WithPolling(migratingStatusPollingInterval).Should(Succeed())
177183
}()
@@ -334,9 +340,15 @@ var _ = Describe("VirtualMachineAffinityAndToleration", framework.CommonE2ETestD
334340
if err != nil {
335341
return err
336342
}
337-
if updatedVMObj.Status.Phase != v1alpha2.MachineMigrating {
338-
return fmt.Errorf("the `VirtualMachine` should be %s", v1alpha2.MachineMigrating)
343+
344+
if updatedVMObj.Status.MigrationState == nil {
345+
return errors.New("the `VirtualMachine` should be migrated")
346+
}
347+
348+
if updatedVMObj.Status.MigrationState.Result != v1alpha2.MigrationResultSucceeded {
349+
return fmt.Errorf("the `VirtualMachine` should migrate to %q", targetNode)
339350
}
351+
340352
return nil
341353
}).WithTimeout(Timeout).WithPolling(migratingStatusPollingInterval).Should(Succeed())
342354
}()
@@ -429,9 +441,15 @@ var _ = Describe("VirtualMachineAffinityAndToleration", framework.CommonE2ETestD
429441
if err != nil {
430442
return err
431443
}
432-
if updatedVMObj.Status.Phase != v1alpha2.MachineMigrating {
433-
return fmt.Errorf("the `VirtualMachine` should be %s", v1alpha2.MachineMigrating)
444+
445+
if updatedVMObj.Status.MigrationState == nil {
446+
return errors.New("the `VirtualMachine` should be migrated")
447+
}
448+
449+
if updatedVMObj.Status.MigrationState.Result != v1alpha2.MigrationResultSucceeded {
450+
return fmt.Errorf("the `VirtualMachine` should migrate to %q", targetNode)
434451
}
452+
435453
return nil
436454
}).WithTimeout(Timeout).WithPolling(migratingStatusPollingInterval).Should(Succeed())
437455
}()

0 commit comments

Comments
 (0)