2019-08-12 19:33:07 +00:00
|
|
|
package kv
|
|
|
|
|
|
|
|
import (
|
2020-12-15 22:07:01 +00:00
|
|
|
"context"
|
2019-08-12 19:33:07 +00:00
|
|
|
"testing"
|
|
|
|
|
2020-08-08 18:39:01 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
2019-08-12 19:33:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// setupDB instantiates and returns a Store instance.
|
|
|
|
func setupDB(t testing.TB) *Store {
|
2021-02-15 20:29:47 +00:00
|
|
|
db, err := NewKVStore(context.Background(), t.TempDir(), &Config{})
|
2020-08-08 18:39:01 +00:00
|
|
|
require.NoError(t, err, "Failed to instantiate DB")
|
2020-05-04 01:14:34 +00:00
|
|
|
t.Cleanup(func() {
|
2020-08-08 18:39:01 +00:00
|
|
|
require.NoError(t, db.Close(), "Failed to close database")
|
2020-05-04 01:14:34 +00:00
|
|
|
})
|
2019-08-12 19:33:07 +00:00
|
|
|
return db
|
|
|
|
}
|