From a9d3435765c010e7642177c70344210f227e32b1 Mon Sep 17 00:00:00 2001 From: Jason Deal Date: Wed, 12 Feb 2025 11:06:06 -0800 Subject: [PATCH] feat: add expectations for reconciler requeue --- test/expectations/expectations.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/expectations/expectations.go b/test/expectations/expectations.go index 1b01d62..36f76a9 100644 --- a/test/expectations/expectations.go +++ b/test/expectations/expectations.go @@ -67,6 +67,16 @@ func ExpectReconciled(ctx context.Context, reconciler reconcile.Reconciler, obje return result } +func ExpectRequeued(result reconcile.Result) { + GinkgoHelper() + Expect(result.Requeue || result.RequeueAfter != lo.Empty[time.Duration]()) +} + +func ExpectNotRequeued(result reconcile.Result) { + GinkgoHelper() + Expect(!result.Requeue && result.RequeueAfter == lo.Empty[time.Duration]()) +} + func ExpectObject[T client.Object](ctx context.Context, c client.Client, obj T) types.Assertion { GinkgoHelper() Expect(c.Get(ctx, client.ObjectKeyFromObject(obj), obj)).To(Succeed())