Skip to content

Commit

Permalink
instancetype: Harden CR upgrade func test
Browse files Browse the repository at this point in the history
When replacing the original CR the test asserts that it is removed from
the cluster. This can take the controller some time to complete in a
busy env so move this check into an Eventually call.

Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
  • Loading branch information
lyarwood committed Sep 5, 2024
1 parent 2513c96 commit b86dcf3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/instancetype/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,12 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c
Expect(decodedObj.GetObjectKind().GroupVersionKind().Version).To(Equal(instancetypeapi.LatestVersion))
}, 30*time.Second, time.Second).Should(Succeed())

// If a new CR has been created assert that the old CR has been deleted
// If a new CR has been created assert that the old CR is eventually deleted
if originalTestRevisionName != revisionName {
_, err := virtClient.AppsV1().ControllerRevisions(vm.Namespace).Get(context.Background(), originalTestRevisionName, metav1.GetOptions{})
Expect(err).Should(HaveOccurred())
Expect(errors.ReasonForError(err)).Should(Equal(metav1.StatusReasonNotFound))
Eventually(func() error {
_, err := virtClient.AppsV1().ControllerRevisions(vm.Namespace).Get(context.Background(), originalTestRevisionName, metav1.GetOptions{})
return err
}, 30*time.Second, time.Second).Should(MatchError(errors.IsNotFound, "errors.IsNotFound"), fmt.Sprintf("ControllerRevision %s has not been deleted", originalTestRevisionName))
}
},
Entry("VirtualMachineInstancetype from v1beta1 without labels to latest",
Expand Down

0 comments on commit b86dcf3

Please sign in to comment.