From 1031a49390d6d49c2c22a884879396f92d1a35a1 Mon Sep 17 00:00:00 2001 From: Traian Schiau Date: Tue, 30 Jan 2024 14:43:14 +0200 Subject: [PATCH] [util/e2e] Rework KueueReadyForTesting. --- test/util/constants.go | 4 ++-- test/util/e2e.go | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/test/util/constants.go b/test/util/constants.go index 1fd9afec7c..b2bc30a411 100644 --- a/test/util/constants.go +++ b/test/util/constants.go @@ -26,8 +26,8 @@ const ( // such as running pods to completion. LongTimeout = 45 * time.Second // StartupTimeout is meant to be used for waiting for Kueue to startup, given - // that cert updates can take up to 2 minutes to propagate to the filesystem. - StartUpTimeout = 3 * time.Minute + // that cert updates can take up to 3 minutes to propagate to the filesystem. + StartUpTimeout = 4 * time.Minute ConsistentDuration = time.Second * 3 Interval = time.Millisecond * 250 ) diff --git a/test/util/e2e.go b/test/util/e2e.go index 4539b02342..eb5b8262f5 100644 --- a/test/util/e2e.go +++ b/test/util/e2e.go @@ -65,11 +65,19 @@ func CreateVisibilityClient(user string) visibilityv1alpha1.VisibilityV1alpha1In return visibilityClient } -func KueueReadyForTesting(ctx context.Context, client client.Client) { +func KueueReadyForTesting(ctx context.Context, c client.Client) { // To verify that webhooks are ready, let's create a simple resourceflavor resourceKueue := utiltesting.MakeResourceFlavor("default").Obj() - gomega.Eventually(func() error { - return client.Create(context.Background(), resourceKueue) + gomega.EventuallyWithOffset(1, func() error { + return c.Create(ctx, resourceKueue) }, StartUpTimeout, Interval).Should(gomega.Succeed()) - ExpectResourceFlavorToBeDeleted(ctx, client, resourceKueue, true) + + gomega.EventuallyWithOffset(1, func() error { + return c.Delete(ctx, resourceKueue) + }, LongTimeout, Interval).Should(gomega.Succeed()) + + gomega.EventuallyWithOffset(1, func() error { + oldRf := &kueue.ResourceFlavor{} + return c.Get(ctx, client.ObjectKeyFromObject(resourceKueue), oldRf) + }, LongTimeout, Interval).Should(utiltesting.BeNotFoundError()) }