Skip to content

Commit

Permalink
fixup! feat: Add NAC restore controller
Browse files Browse the repository at this point in the history
add more tests

Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 committed Nov 19, 2024
1 parent 91c6701 commit 862c0ff
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion internal/controller/nonadminrestore_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ var _ = ginkgo.Describe("Test full reconcile loop of NonAdminRestore Controller"

gomega.Expect(checkTestNonAdminRestoreStatus(nonAdminRestore, scenario.status)).To(gomega.Succeed())

veleroRestore := &velerov1.Restore{}
if scenario.status.VeleroRestore != nil && len(nonAdminRestore.Status.UUID) > 0 {
ginkgo.By("Checking if NonAdminRestore Spec was not changed")
gomega.Expect(reflect.DeepEqual(
Expand All @@ -245,7 +246,6 @@ var _ = ginkgo.Describe("Test full reconcile loop of NonAdminRestore Controller"

ginkgo.By("Simulating Velero Restore update to finished state")

veleroRestore := &velerov1.Restore{}
gomega.Expect(k8sClient.Get(
ctxTimeout,
types.NamespacedName{
Expand Down Expand Up @@ -299,6 +299,22 @@ var _ = ginkgo.Describe("Test full reconcile loop of NonAdminRestore Controller"
}
return false, err
}, 10*time.Second, 1*time.Second).Should(gomega.BeTrue())
if scenario.status.VeleroRestore != nil && len(nonAdminRestore.Status.UUID) > 0 {
gomega.Eventually(func() (bool, error) {
err := k8sClient.Get(
ctxTimeout,
types.NamespacedName{
Name: nonAdminRestore.Status.VeleroRestore.Name,
Namespace: oadpNamespace,
},
veleroRestore,
)
if apierrors.IsNotFound(err) {
return true, nil
}
return false, err
}, 10*time.Second, 1*time.Second).Should(gomega.BeTrue())
}
},
ginkgo.Entry("Should update NonAdminRestore until Velero Restore completes and then delete it", nonAdminRestoreFullReconcileScenario{
spec: nacv1alpha1.NonAdminRestoreSpec{
Expand Down

0 comments on commit 862c0ff

Please sign in to comment.