mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 12:27:18 +00:00
2f11e55869
* use t.TempDir() * remove redundant delete * simplify setupDB() * simplify db/testing/setup_db * fix tests
21 lines
604 B
Go
21 lines
604 B
Go
package kv
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
|
)
|
|
|
|
// setupDB instantiates and returns a DB instance for the validator client.
|
|
func setupDB(t testing.TB, pubkeys [][48]byte) *Store {
|
|
db, err := NewKVStore(t.TempDir(), pubkeys)
|
|
require.NoError(t, err, "Failed to instantiate DB")
|
|
err = db.OldUpdatePublicKeysBuckets(pubkeys)
|
|
require.NoError(t, err, "Failed to create old buckets for public keys")
|
|
t.Cleanup(func() {
|
|
require.NoError(t, db.Close(), "Failed to close database")
|
|
require.NoError(t, db.ClearDB(), "Failed to clear database")
|
|
})
|
|
return db
|
|
}
|