Skip to content

Commit

Permalink
tests/e2e, persistentip, primaryUDN: Refresh vmi after migration/restart
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
RamLavi committed Sep 26, 2024
1 parent 0c88bc4 commit d3f56d5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/e2e/persistentips-primary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit d3f56d5

Please sign in to comment.