From 23a8c622ff0d895e7f4e1cb093de73b6bfbc24c9 Mon Sep 17 00:00:00 2001 From: Andrii Korotkov Date: Fri, 14 Mar 2025 23:27:54 -0700 Subject: [PATCH 1/2] fix: Account for batch event processing in e2e tests Address tests flakiness by adjusting batch event processing time to 1ms in e2e tests (as there's little to process) and waiting for 5ms in When and Then to account for that delay. Signed-off-by: Andrii Korotkov --- Makefile | 1 + test/e2e/fixture/account/actions.go | 4 ++++ test/e2e/fixture/account/consequences.go | 3 +++ test/e2e/fixture/account/context.go | 3 +++ test/e2e/fixture/admin/actions.go | 4 ++++ test/e2e/fixture/admin/consequences.go | 4 ++++ test/e2e/fixture/admin/context.go | 3 +++ test/e2e/fixture/app/actions.go | 3 +++ test/e2e/fixture/app/consequences.go | 2 ++ test/e2e/fixture/app/context.go | 2 ++ test/e2e/fixture/applicationsets/actions.go | 2 ++ test/e2e/fixture/applicationsets/consequences.go | 2 ++ test/e2e/fixture/applicationsets/context.go | 2 ++ test/e2e/fixture/cluster/actions.go | 3 +++ test/e2e/fixture/cluster/consequences.go | 3 +++ test/e2e/fixture/cluster/context.go | 3 +++ test/e2e/fixture/notification/actions.go | 4 ++++ test/e2e/fixture/notification/consequences.go | 3 +++ test/e2e/fixture/notification/context.go | 3 +++ test/e2e/fixture/project/actions.go | 3 +++ test/e2e/fixture/project/consequences.go | 3 +++ test/e2e/fixture/project/context.go | 3 +++ test/e2e/fixture/repos/actions.go | 3 +++ test/e2e/fixture/repos/consequences.go | 3 +++ test/e2e/fixture/repos/context.go | 3 +++ 25 files changed, 72 insertions(+) diff --git a/Makefile b/Makefile index 8dec6f04a4143..9f8adf87d44c6 100644 --- a/Makefile +++ b/Makefile @@ -486,6 +486,7 @@ start-e2e-local: mod-vendor-local dep-ui-local cli-local ARGOCD_APPLICATIONSET_CONTROLLER_ALLOWED_SCM_PROVIDERS=http://127.0.0.1:8341,http://127.0.0.1:8342,http://127.0.0.1:8343,http://127.0.0.1:8344 \ ARGOCD_E2E_TEST=true \ ARGOCD_HYDRATOR_ENABLED=true \ + ARGOCD_CLUSTER_CACHE_EVENTS_PROCESSING_INTERVAL=1ms \ goreman -f $(ARGOCD_PROCFILE) start ${ARGOCD_START} ls -lrt /tmp/coverage diff --git a/test/e2e/fixture/account/actions.go b/test/e2e/fixture/account/actions.go index aafd7e1136162..fb612ff2ba96f 100644 --- a/test/e2e/fixture/account/actions.go +++ b/test/e2e/fixture/account/actions.go @@ -1,6 +1,8 @@ package project import ( + "time" + "github.com/stretchr/testify/require" "github.com/argoproj/argo-cd/v3/test/e2e/fixture" @@ -81,5 +83,7 @@ func (a *Actions) runCli(args ...string) { func (a *Actions) Then() *Consequences { a.context.t.Helper() + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/account/consequences.go b/test/e2e/fixture/account/consequences.go index 9c526edbbb0c1..32c1dcb1f08d7 100644 --- a/test/e2e/fixture/account/consequences.go +++ b/test/e2e/fixture/account/consequences.go @@ -3,6 +3,7 @@ package project import ( "context" "errors" + "time" "github.com/stretchr/testify/require" @@ -64,5 +65,7 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return c.actions } diff --git a/test/e2e/fixture/account/context.go b/test/e2e/fixture/account/context.go index d639faf1969fa..7718326b06647 100644 --- a/test/e2e/fixture/account/context.go +++ b/test/e2e/fixture/account/context.go @@ -2,6 +2,7 @@ package project import ( "testing" + "time" "github.com/argoproj/argo-cd/v3/test/e2e/fixture" "github.com/argoproj/argo-cd/v3/util/env" @@ -45,5 +46,7 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Actions{context: c} } diff --git a/test/e2e/fixture/admin/actions.go b/test/e2e/fixture/admin/actions.go index e25de18bbaa32..5b0ea706c9d11 100644 --- a/test/e2e/fixture/admin/actions.go +++ b/test/e2e/fixture/admin/actions.go @@ -1,6 +1,8 @@ package admin import ( + "time" + "github.com/argoproj/argo-cd/v3/test/e2e/fixture" ) @@ -63,5 +65,7 @@ func (a *Actions) runCliWithStdin(stdin string, args ...string) { func (a *Actions) Then() *Consequences { a.context.t.Helper() + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/admin/consequences.go b/test/e2e/fixture/admin/consequences.go index b9bf1dcc28dc9..586042fe3191f 100644 --- a/test/e2e/fixture/admin/consequences.go +++ b/test/e2e/fixture/admin/consequences.go @@ -1,6 +1,8 @@ package admin import ( + "time" + . "github.com/argoproj/argo-cd/v3/test/e2e/fixture/admin/utils" ) @@ -33,5 +35,7 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return c.actions } diff --git a/test/e2e/fixture/admin/context.go b/test/e2e/fixture/admin/context.go index 76d91af8677f8..cb35046f266b3 100644 --- a/test/e2e/fixture/admin/context.go +++ b/test/e2e/fixture/admin/context.go @@ -2,6 +2,7 @@ package admin import ( "testing" + "time" "github.com/argoproj/argo-cd/v3/test/e2e/fixture" "github.com/argoproj/argo-cd/v3/util/env" @@ -39,5 +40,7 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Actions{context: c} } diff --git a/test/e2e/fixture/app/actions.go b/test/e2e/fixture/app/actions.go index d880f1b40cc33..8e907aa7d4406 100644 --- a/test/e2e/fixture/app/actions.go +++ b/test/e2e/fixture/app/actions.go @@ -6,6 +6,7 @@ import ( "os" "slices" "strconv" + "time" rbacv1 "k8s.io/api/rbac/v1" @@ -492,6 +493,8 @@ func (a *Actions) And(block func()) *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Consequences{a.context, a, 15} } diff --git a/test/e2e/fixture/app/consequences.go b/test/e2e/fixture/app/consequences.go index 05fdb17a2af4d..aa71e8184d180 100644 --- a/test/e2e/fixture/app/consequences.go +++ b/test/e2e/fixture/app/consequences.go @@ -101,6 +101,8 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return c.actions } diff --git a/test/e2e/fixture/app/context.go b/test/e2e/fixture/app/context.go index 50d33955cd948..03ede39bd55e0 100644 --- a/test/e2e/fixture/app/context.go +++ b/test/e2e/fixture/app/context.go @@ -349,6 +349,8 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Actions{context: c} } diff --git a/test/e2e/fixture/applicationsets/actions.go b/test/e2e/fixture/applicationsets/actions.go index ebf755b3438aa..44ed8d2d21fe3 100644 --- a/test/e2e/fixture/applicationsets/actions.go +++ b/test/e2e/fixture/applicationsets/actions.go @@ -61,6 +61,8 @@ func (a *Actions) And(block func()) *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/applicationsets/consequences.go b/test/e2e/fixture/applicationsets/consequences.go index 22dea84247a08..0df6d5774e7ad 100644 --- a/test/e2e/fixture/applicationsets/consequences.go +++ b/test/e2e/fixture/applicationsets/consequences.go @@ -71,6 +71,8 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return c.actions } diff --git a/test/e2e/fixture/applicationsets/context.go b/test/e2e/fixture/applicationsets/context.go index 4533bb61c3948..c17c5cb1f6b13 100644 --- a/test/e2e/fixture/applicationsets/context.go +++ b/test/e2e/fixture/applicationsets/context.go @@ -29,6 +29,8 @@ func Given(t *testing.T) *Context { } func (c *Context) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Actions{context: c} } diff --git a/test/e2e/fixture/cluster/actions.go b/test/e2e/fixture/cluster/actions.go index 4c03cf570524a..6accff4aff789 100644 --- a/test/e2e/fixture/cluster/actions.go +++ b/test/e2e/fixture/cluster/actions.go @@ -5,6 +5,7 @@ import ( "errors" "log" "strings" + "time" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" @@ -131,6 +132,8 @@ func (a *Actions) DeleteByServer() *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/cluster/consequences.go b/test/e2e/fixture/cluster/consequences.go index d6a856708a91c..14446f9492215 100644 --- a/test/e2e/fixture/cluster/consequences.go +++ b/test/e2e/fixture/cluster/consequences.go @@ -3,6 +3,7 @@ package cluster import ( "context" "errors" + "time" clusterpkg "github.com/argoproj/argo-cd/v3/pkg/apiclient/cluster" "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" @@ -54,5 +55,7 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return c.actions } diff --git a/test/e2e/fixture/cluster/context.go b/test/e2e/fixture/cluster/context.go index 83d1541772fe7..6fe2f19e64873 100644 --- a/test/e2e/fixture/cluster/context.go +++ b/test/e2e/fixture/cluster/context.go @@ -2,6 +2,7 @@ package cluster import ( "testing" + "time" "github.com/argoproj/argo-cd/v3/test/e2e/fixture" "github.com/argoproj/argo-cd/v3/util/env" @@ -59,6 +60,8 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Actions{context: c} } diff --git a/test/e2e/fixture/notification/actions.go b/test/e2e/fixture/notification/actions.go index 81b35e50de3d7..83c05f3530192 100644 --- a/test/e2e/fixture/notification/actions.go +++ b/test/e2e/fixture/notification/actions.go @@ -1,6 +1,8 @@ package notification import ( + "time" + "github.com/stretchr/testify/require" "github.com/argoproj/argo-cd/v3/test/e2e/fixture" @@ -24,6 +26,8 @@ func (a *Actions) SetParamInNotificationConfigMap(key, value string) *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/notification/consequences.go b/test/e2e/fixture/notification/consequences.go index 4401268a45928..c0ad7fbb803d8 100644 --- a/test/e2e/fixture/notification/consequences.go +++ b/test/e2e/fixture/notification/consequences.go @@ -2,6 +2,7 @@ package notification import ( "context" + "time" "github.com/argoproj/argo-cd/v3/pkg/apiclient/notification" "github.com/argoproj/argo-cd/v3/test/e2e/fixture" @@ -53,6 +54,8 @@ func (c *Consequences) listTemplates() (*notification.TemplateList, error) { } func (c *Consequences) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return c.actions } diff --git a/test/e2e/fixture/notification/context.go b/test/e2e/fixture/notification/context.go index 3bf075ff54ddb..1859e1b378528 100644 --- a/test/e2e/fixture/notification/context.go +++ b/test/e2e/fixture/notification/context.go @@ -2,6 +2,7 @@ package notification import ( "testing" + "time" "github.com/argoproj/argo-cd/v3/test/e2e/fixture" ) @@ -23,5 +24,7 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Actions{context: c} } diff --git a/test/e2e/fixture/project/actions.go b/test/e2e/fixture/project/actions.go index 7e2df3b3e7756..1290c0461b57a 100644 --- a/test/e2e/fixture/project/actions.go +++ b/test/e2e/fixture/project/actions.go @@ -3,6 +3,7 @@ package project import ( "context" "strings" + "time" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -112,6 +113,8 @@ func (a *Actions) And(block func()) *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/project/consequences.go b/test/e2e/fixture/project/consequences.go index 3abcec5053555..929c38d3d0a5e 100644 --- a/test/e2e/fixture/project/consequences.go +++ b/test/e2e/fixture/project/consequences.go @@ -2,6 +2,7 @@ package project import ( "context" + "time" "github.com/argoproj/argo-cd/v3/pkg/apiclient/project" @@ -43,5 +44,7 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return c.actions } diff --git a/test/e2e/fixture/project/context.go b/test/e2e/fixture/project/context.go index d0f9118a5b603..43dd8715aa83f 100644 --- a/test/e2e/fixture/project/context.go +++ b/test/e2e/fixture/project/context.go @@ -2,6 +2,7 @@ package project import ( "testing" + "time" "github.com/argoproj/argo-cd/v3/test/e2e/fixture" "github.com/argoproj/argo-cd/v3/util/env" @@ -68,5 +69,7 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Actions{context: c} } diff --git a/test/e2e/fixture/repos/actions.go b/test/e2e/fixture/repos/actions.go index c573632dfd9b3..38bf1a3bc01e0 100644 --- a/test/e2e/fixture/repos/actions.go +++ b/test/e2e/fixture/repos/actions.go @@ -2,6 +2,7 @@ package repos import ( "log" + "time" "github.com/argoproj/argo-cd/v3/test/e2e/fixture" ) @@ -77,6 +78,8 @@ func (a *Actions) Project(project string) *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/repos/consequences.go b/test/e2e/fixture/repos/consequences.go index 77658077b46d8..f1be83653eefd 100644 --- a/test/e2e/fixture/repos/consequences.go +++ b/test/e2e/fixture/repos/consequences.go @@ -3,6 +3,7 @@ package repos import ( "context" "errors" + "time" repositorypkg "github.com/argoproj/argo-cd/v3/pkg/apiclient/repository" "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" @@ -54,5 +55,7 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return c.actions } diff --git a/test/e2e/fixture/repos/context.go b/test/e2e/fixture/repos/context.go index bb99f7ef2a450..3f9cca86c3863 100644 --- a/test/e2e/fixture/repos/context.go +++ b/test/e2e/fixture/repos/context.go @@ -2,6 +2,7 @@ package repos import ( "testing" + "time" "github.com/argoproj/argo-cd/v3/test/e2e/fixture" "github.com/argoproj/argo-cd/v3/util/env" @@ -54,6 +55,8 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { + // Account for batch events processing (set to 1ms in e2e tests) + time.Sleep(5 * time.Millisecond) return &Actions{context: c} } From 1af99748eacbe0a5f1d031cdf9bbb4387d266a13 Mon Sep 17 00:00:00 2001 From: Andrii Korotkov Date: Mon, 17 Mar 2025 08:59:04 -0700 Subject: [PATCH 2/2] Add a constant for a sleep time Signed-off-by: Andrii Korotkov --- test/e2e/fixture/account/actions.go | 3 +-- test/e2e/fixture/account/consequences.go | 3 +-- test/e2e/fixture/account/context.go | 3 +-- test/e2e/fixture/admin/actions.go | 3 +-- test/e2e/fixture/admin/consequences.go | 4 ++-- test/e2e/fixture/admin/context.go | 3 +-- test/e2e/fixture/app/actions.go | 3 +-- test/e2e/fixture/app/consequences.go | 3 +-- test/e2e/fixture/app/context.go | 3 +-- test/e2e/fixture/applicationsets/actions.go | 3 +-- test/e2e/fixture/applicationsets/consequences.go | 3 +-- test/e2e/fixture/applicationsets/context.go | 3 +-- test/e2e/fixture/cluster/actions.go | 3 +-- test/e2e/fixture/cluster/consequences.go | 3 +-- test/e2e/fixture/cluster/context.go | 3 +-- test/e2e/fixture/fixture.go | 3 +++ test/e2e/fixture/notification/actions.go | 3 +-- test/e2e/fixture/notification/consequences.go | 3 +-- test/e2e/fixture/notification/context.go | 3 +-- test/e2e/fixture/project/actions.go | 3 +-- test/e2e/fixture/project/consequences.go | 3 +-- test/e2e/fixture/project/context.go | 3 +-- test/e2e/fixture/repos/actions.go | 3 +-- test/e2e/fixture/repos/consequences.go | 3 +-- test/e2e/fixture/repos/context.go | 3 +-- 25 files changed, 28 insertions(+), 48 deletions(-) diff --git a/test/e2e/fixture/account/actions.go b/test/e2e/fixture/account/actions.go index fb612ff2ba96f..209d824254e48 100644 --- a/test/e2e/fixture/account/actions.go +++ b/test/e2e/fixture/account/actions.go @@ -83,7 +83,6 @@ func (a *Actions) runCli(args ...string) { func (a *Actions) Then() *Consequences { a.context.t.Helper() - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/account/consequences.go b/test/e2e/fixture/account/consequences.go index 32c1dcb1f08d7..d59008b1ba1ce 100644 --- a/test/e2e/fixture/account/consequences.go +++ b/test/e2e/fixture/account/consequences.go @@ -65,7 +65,6 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return c.actions } diff --git a/test/e2e/fixture/account/context.go b/test/e2e/fixture/account/context.go index 7718326b06647..2f9af3b47ada5 100644 --- a/test/e2e/fixture/account/context.go +++ b/test/e2e/fixture/account/context.go @@ -46,7 +46,6 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Actions{context: c} } diff --git a/test/e2e/fixture/admin/actions.go b/test/e2e/fixture/admin/actions.go index 5b0ea706c9d11..1c534df0f9501 100644 --- a/test/e2e/fixture/admin/actions.go +++ b/test/e2e/fixture/admin/actions.go @@ -65,7 +65,6 @@ func (a *Actions) runCliWithStdin(stdin string, args ...string) { func (a *Actions) Then() *Consequences { a.context.t.Helper() - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/admin/consequences.go b/test/e2e/fixture/admin/consequences.go index 586042fe3191f..9b81d4fa740fc 100644 --- a/test/e2e/fixture/admin/consequences.go +++ b/test/e2e/fixture/admin/consequences.go @@ -3,6 +3,7 @@ package admin import ( "time" + "github.com/argoproj/argo-cd/v3/test/e2e/fixture" . "github.com/argoproj/argo-cd/v3/test/e2e/fixture/admin/utils" ) @@ -35,7 +36,6 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return c.actions } diff --git a/test/e2e/fixture/admin/context.go b/test/e2e/fixture/admin/context.go index cb35046f266b3..8b8b44bef4595 100644 --- a/test/e2e/fixture/admin/context.go +++ b/test/e2e/fixture/admin/context.go @@ -40,7 +40,6 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Actions{context: c} } diff --git a/test/e2e/fixture/app/actions.go b/test/e2e/fixture/app/actions.go index 8e907aa7d4406..47083b86fbef9 100644 --- a/test/e2e/fixture/app/actions.go +++ b/test/e2e/fixture/app/actions.go @@ -493,8 +493,7 @@ func (a *Actions) And(block func()) *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Consequences{a.context, a, 15} } diff --git a/test/e2e/fixture/app/consequences.go b/test/e2e/fixture/app/consequences.go index aa71e8184d180..39c7839aa1550 100644 --- a/test/e2e/fixture/app/consequences.go +++ b/test/e2e/fixture/app/consequences.go @@ -101,8 +101,7 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return c.actions } diff --git a/test/e2e/fixture/app/context.go b/test/e2e/fixture/app/context.go index 03ede39bd55e0..435f8041723dc 100644 --- a/test/e2e/fixture/app/context.go +++ b/test/e2e/fixture/app/context.go @@ -349,8 +349,7 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Actions{context: c} } diff --git a/test/e2e/fixture/applicationsets/actions.go b/test/e2e/fixture/applicationsets/actions.go index 44ed8d2d21fe3..89c217e3ec19a 100644 --- a/test/e2e/fixture/applicationsets/actions.go +++ b/test/e2e/fixture/applicationsets/actions.go @@ -61,8 +61,7 @@ func (a *Actions) And(block func()) *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/applicationsets/consequences.go b/test/e2e/fixture/applicationsets/consequences.go index 0df6d5774e7ad..1cab2b8e0067f 100644 --- a/test/e2e/fixture/applicationsets/consequences.go +++ b/test/e2e/fixture/applicationsets/consequences.go @@ -71,8 +71,7 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return c.actions } diff --git a/test/e2e/fixture/applicationsets/context.go b/test/e2e/fixture/applicationsets/context.go index c17c5cb1f6b13..00bd71a1d07d5 100644 --- a/test/e2e/fixture/applicationsets/context.go +++ b/test/e2e/fixture/applicationsets/context.go @@ -29,8 +29,7 @@ func Given(t *testing.T) *Context { } func (c *Context) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Actions{context: c} } diff --git a/test/e2e/fixture/cluster/actions.go b/test/e2e/fixture/cluster/actions.go index 6accff4aff789..66112efb786d7 100644 --- a/test/e2e/fixture/cluster/actions.go +++ b/test/e2e/fixture/cluster/actions.go @@ -132,8 +132,7 @@ func (a *Actions) DeleteByServer() *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/cluster/consequences.go b/test/e2e/fixture/cluster/consequences.go index 14446f9492215..97a456b53e28d 100644 --- a/test/e2e/fixture/cluster/consequences.go +++ b/test/e2e/fixture/cluster/consequences.go @@ -55,7 +55,6 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return c.actions } diff --git a/test/e2e/fixture/cluster/context.go b/test/e2e/fixture/cluster/context.go index 6fe2f19e64873..8668797065505 100644 --- a/test/e2e/fixture/cluster/context.go +++ b/test/e2e/fixture/cluster/context.go @@ -60,8 +60,7 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Actions{context: c} } diff --git a/test/e2e/fixture/fixture.go b/test/e2e/fixture/fixture.go index 55e82fbc919b3..98a2d6ff1c5f9 100644 --- a/test/e2e/fixture/fixture.go +++ b/test/e2e/fixture/fixture.go @@ -66,6 +66,9 @@ const ( PluginSockFilePath = "/app/config/plugin" E2ETestPrefix = "e2e-test-" + + // Account for batch events processing (set to 1ms in e2e tests) + WhenThenSleepInterval = 5 * time.Millisecond ) const ( diff --git a/test/e2e/fixture/notification/actions.go b/test/e2e/fixture/notification/actions.go index 83c05f3530192..6a42eb1d92fcd 100644 --- a/test/e2e/fixture/notification/actions.go +++ b/test/e2e/fixture/notification/actions.go @@ -26,8 +26,7 @@ func (a *Actions) SetParamInNotificationConfigMap(key, value string) *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/notification/consequences.go b/test/e2e/fixture/notification/consequences.go index c0ad7fbb803d8..6fdd8df5ee020 100644 --- a/test/e2e/fixture/notification/consequences.go +++ b/test/e2e/fixture/notification/consequences.go @@ -54,8 +54,7 @@ func (c *Consequences) listTemplates() (*notification.TemplateList, error) { } func (c *Consequences) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return c.actions } diff --git a/test/e2e/fixture/notification/context.go b/test/e2e/fixture/notification/context.go index 1859e1b378528..86fcad7727d83 100644 --- a/test/e2e/fixture/notification/context.go +++ b/test/e2e/fixture/notification/context.go @@ -24,7 +24,6 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Actions{context: c} } diff --git a/test/e2e/fixture/project/actions.go b/test/e2e/fixture/project/actions.go index 1290c0461b57a..39e590c4631f2 100644 --- a/test/e2e/fixture/project/actions.go +++ b/test/e2e/fixture/project/actions.go @@ -113,8 +113,7 @@ func (a *Actions) And(block func()) *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/project/consequences.go b/test/e2e/fixture/project/consequences.go index 929c38d3d0a5e..94d868c06d56b 100644 --- a/test/e2e/fixture/project/consequences.go +++ b/test/e2e/fixture/project/consequences.go @@ -44,7 +44,6 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return c.actions } diff --git a/test/e2e/fixture/project/context.go b/test/e2e/fixture/project/context.go index 43dd8715aa83f..6c1aa2bb0d6d9 100644 --- a/test/e2e/fixture/project/context.go +++ b/test/e2e/fixture/project/context.go @@ -69,7 +69,6 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Actions{context: c} } diff --git a/test/e2e/fixture/repos/actions.go b/test/e2e/fixture/repos/actions.go index 38bf1a3bc01e0..71d483fda7a62 100644 --- a/test/e2e/fixture/repos/actions.go +++ b/test/e2e/fixture/repos/actions.go @@ -78,8 +78,7 @@ func (a *Actions) Project(project string) *Actions { func (a *Actions) Then() *Consequences { a.context.t.Helper() - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Consequences{a.context, a} } diff --git a/test/e2e/fixture/repos/consequences.go b/test/e2e/fixture/repos/consequences.go index f1be83653eefd..34a891914c671 100644 --- a/test/e2e/fixture/repos/consequences.go +++ b/test/e2e/fixture/repos/consequences.go @@ -55,7 +55,6 @@ func (c *Consequences) Given() *Context { } func (c *Consequences) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return c.actions } diff --git a/test/e2e/fixture/repos/context.go b/test/e2e/fixture/repos/context.go index 3f9cca86c3863..57e6b4c127e8f 100644 --- a/test/e2e/fixture/repos/context.go +++ b/test/e2e/fixture/repos/context.go @@ -55,8 +55,7 @@ func (c *Context) And(block func()) *Context { } func (c *Context) When() *Actions { - // Account for batch events processing (set to 1ms in e2e tests) - time.Sleep(5 * time.Millisecond) + time.Sleep(fixture.WhenThenSleepInterval) return &Actions{context: c} }