Skip to content

Commit

Permalink
controller: address test flake
Browse files Browse the repository at this point in the history
As the Kubernetes client used in tests is cache backed, it can take a
tiny bit of time for the client to actually notice the removal.

Wrapping in `Eventually` should address this.

Signed-off-by: Hidde Beydals <[email protected]>
  • Loading branch information
hiddeco committed Dec 11, 2023
1 parent f3e4789 commit 45fcf67
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions internal/controller/helmrelease_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -852,12 +852,14 @@ func TestHelmReleaseReconciler_reconcileDelete(t *testing.T) {
g.Expect(err).To(MatchError(helmdriver.ErrReleaseNotFound))

// Verify Helm chart has been removed.
err = testEnv.Get(context.TODO(), client.ObjectKey{
Namespace: hc.Namespace,
Name: hc.Name,
}, &sourcev1b2.HelmChart{})
g.Expect(err).To(HaveOccurred())
g.Expect(apierrors.IsNotFound(err)).To(BeTrue())
g.Eventually(func(g Gomega) {
err = testEnv.Get(context.TODO(), client.ObjectKey{
Namespace: hc.Namespace,
Name: hc.Name,
}, &sourcev1b2.HelmChart{})
g.Expect(err).To(HaveOccurred())
g.Expect(apierrors.IsNotFound(err)).To(BeTrue())
})
})

t.Run("removes finalizer for suspended resource with DeletionTimestamp", func(t *testing.T) {
Expand Down

0 comments on commit 45fcf67

Please sign in to comment.