Skip to content

Commit

Permalink
fix db test data race for queue tick interval (#29276)
Browse files Browse the repository at this point in the history
  • Loading branch information
fairclothjm authored Jan 3, 2025
1 parent 7c1d6e5 commit 9a83073
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions builtin/logical/database/rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand Down

0 comments on commit 9a83073

Please sign in to comment.