Remove flakiness from main migration test
Give the migration controller some time to update the VM state after a
migration job completed successfully. This removes cases where the
functional test processed the pod success messages before the pod
controller processed it.
@@ -131,6 +131,14 @@ var _ = Describe("VmMigration", func() {
return jobs.Items[0].Status.Phase
}, TIMEOUT*2, POLLING_INTERVAL).Should(Equal(k8sv1.PodSucceeded))
+ // Give the pod controller some time to update the VM after successful migrations
+ Eventually(func() v1.VMPhase {
+ obj, err := restClient.Get().Resource("vms").Namespace(k8sv1.NamespaceDefault).Name(obj.(*v1.VM).ObjectMeta.Name).Do().Get()
+ Expect(err).ToNot(HaveOccurred())
+ fetchedVM := obj.(*v1.VM)
+ return fetchedVM.Status.Phase
+ }, TIMEOUT, POLLING_INTERVAL).Should(Equal(v1.Running))
+
obj, err = restClient.Get().Resource("vms").Namespace(k8sv1.NamespaceDefault).Name(obj.(*v1.VM).ObjectMeta.Name).Do().Get()
Expect(err).ToNot(HaveOccurred())
migratedVM := obj.(*v1.VM)
