From a1df094dbdcca71b5b2859c595bb7dbb07163424 Mon Sep 17 00:00:00 2001 From: Ram Lavi Date: Thu, 26 Sep 2024 13:22:14 +0300 Subject: [PATCH] tests/e2e, persistentip, primaryUDN: Refresh vmi after migration/restart In some cases after migration/restart the VMI object is not refreshed, making it so that the object may be already irrelevant. In order to prevent that, refresh the vmi instance as done in other tests. Signed-off-by: Ram Lavi --- test/e2e/persistentips-primary_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/e2e/persistentips-primary_test.go b/test/e2e/persistentips-primary_test.go index db4cd36a..06e23c5c 100644 --- a/test/e2e/persistentips-primary_test.go +++ b/test/e2e/persistentips-primary_test.go @@ -116,6 +116,8 @@ var _ = Describe("Persistent IPs on Primary UDN interface", func() { WithTimeout(5 * time.Minute). Should(testenv.ContainConditionVMIReady()) + Expect(testenv.Client.Get(context.Background(), client.ObjectKeyFromObject(vmi), vmi)).To(Succeed()) + targetVMIDefaultNetworkStatus, err := getDefaultNetworkStatus(vmi) Expect(err).ToNot(HaveOccurred()) Expect(targetVMIDefaultNetworkStatus.Interface).To(Equal(originalVMIDefaultNetworkStatus.Interface)) @@ -198,6 +200,8 @@ var _ = Describe("Persistent IPs on Primary UDN interface", func() { WithTimeout(5 * time.Minute). Should(testenv.ContainConditionVMIReady()) + Expect(testenv.Client.Get(context.Background(), client.ObjectKeyFromObject(vmi), vmi)).To(Succeed()) + defaultNetworkStatusAfterRestart, err := getDefaultNetworkStatus(vmi) Expect(err).ToNot(HaveOccurred()) Expect(defaultNetworkStatusAfterRestart.Interface).To(Equal(defaultNetworkStatusBeforeRestart.Interface)) @@ -289,6 +293,8 @@ var _ = Describe("Persistent IPs on Primary UDN interface", func() { testenv.LiveMigrateVirtualMachine(td.Namespace, vmi.Name) testenv.CheckLiveMigrationSucceeded(td.Namespace, vmi.Name) + Expect(testenv.Client.Get(context.Background(), client.ObjectKeyFromObject(vmi), vmi)).To(Succeed()) + targetVMIDefaultNetworkStatus, err := getDefaultNetworkStatus(vmi) Expect(err).ToNot(HaveOccurred()) Expect(targetVMIDefaultNetworkStatus.Interface).To(Equal(originalVMIDefaultNetworkStatus.Interface))