2019-08-12 19:33:07 +00:00
|
|
|
package kv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-03-30 22:10:45 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/cache"
|
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 {
|
2020-11-10 22:45:17 +00:00
|
|
|
db, err := NewKVStore(t.TempDir(), cache.NewStateSummaryCache())
|
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
|
|
|
|
}
|