From 758e7b8bf1bb0534a6ec2175dfdac563cbceb4e6 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Mon, 4 Dec 2023 22:40:39 +0000 Subject: [PATCH] test(credentials): Disable rate limiting for test This test quickly polls a list endpoint, which exceeds the default rate limits before the test can complete in CI. --- internal/daemon/controller/testing.go | 6 ++++++ internal/tests/api/credentials/credentials_test.go | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/daemon/controller/testing.go b/internal/daemon/controller/testing.go index 8fb99e592..04431068e 100644 --- a/internal/daemon/controller/testing.go +++ b/internal/daemon/controller/testing.go @@ -495,6 +495,8 @@ type TestControllerOpts struct { // Toggle worker auth debugging WorkerAuthDebuggingEnabled *atomic.Bool + + DisableRateLimiting bool } func NewTestController(t testing.TB, opts *TestControllerOpts) *TestController { @@ -806,6 +808,10 @@ func TestControllerConfig(t testing.TB, ctx context.Context, tc *TestController, } } + if opts.DisableRateLimiting { + opts.Config.Controller.ApiRateLimitDisable = true + } + return &Config{ RawConfig: opts.Config, Server: tc.b, diff --git a/internal/tests/api/credentials/credentials_test.go b/internal/tests/api/credentials/credentials_test.go index 397eeed2e..e98f58725 100644 --- a/internal/tests/api/credentials/credentials_test.go +++ b/internal/tests/api/credentials/credentials_test.go @@ -415,7 +415,13 @@ func TestUpdateAfterKeyRotation(t *testing.T) { // This prevents us from running tests in parallel. tg.SetupSuiteTargetFilters(t) - tc := controller.NewTestController(t, &controller.TestControllerOpts{SchedulerRunJobInterval: 100 * time.Millisecond}) + tc := controller.NewTestController( + t, + &controller.TestControllerOpts{ + SchedulerRunJobInterval: 100 * time.Millisecond, + DisableRateLimiting: true, + }, + ) ctx := tc.Context() client := tc.Client() token := tc.Token()