From 9a830736c8134fcb4ef6b4b44a89ee8fbdad8751 Mon Sep 17 00:00:00 2001 From: John-Michael Faircloth Date: Fri, 3 Jan 2025 09:27:10 -0600 Subject: [PATCH] fix db test data race for queue tick interval (#29276) --- builtin/logical/database/rotation_test.go | 33 ++++++++++------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/builtin/logical/database/rotation_test.go b/builtin/logical/database/rotation_test.go index 7ab4311d1255..84a4df9078cd 100644 --- a/builtin/logical/database/rotation_test.go +++ b/builtin/logical/database/rotation_test.go @@ -1032,25 +1032,20 @@ func TestQueueTickIntervalKeyConfig(t *testing.T) { cluster, sys := getClusterPostgresDB(t) defer cluster.Cleanup() - config := logical.TestBackendConfig() - config.StorageView = &logical.InmemStorage{} - config.System = sys - config.Config[queueTickIntervalKey] = "1" - - // Rotation ticker starts running in Factory call - b, err := Factory(context.Background(), config) - require.Nil(t, err) - b.Cleanup(context.Background()) - - config.Config[queueTickIntervalKey] = "0" - b, err = Factory(context.Background(), config) - require.Nil(t, err) - b.Cleanup(context.Background()) - - config.Config[queueTickIntervalKey] = "-1" - b, err = Factory(context.Background(), config) - require.Nil(t, err) - b.Cleanup(context.Background()) + values := []string{"1", "0", "-1"} + for _, v := range values { + t.Run("test"+v, func(t *testing.T) { + config := logical.TestBackendConfig() + config.StorageView = &logical.InmemStorage{} + config.System = sys + config.Config[queueTickIntervalKey] = v + + // Rotation ticker starts running in Factory call + b, err := Factory(context.Background(), config) + require.Nil(t, err) + b.Cleanup(context.Background()) + }) + } } func testBackend_StaticRole_Rotations(t *testing.T, createUser userCreator, opts map[string]interface{}) {