mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 20:07:17 +00:00
d17996f8b0
* Update V3 from V4 * Fix build v3 -> v4 * Update ssz * Update beacon_chain.pb.go * Fix formatter import * Update update-mockgen.sh comment to v4 * Fix conflicts. Pass build and tests * Fix test
34 lines
891 B
Go
34 lines
891 B
Go
package kv
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"testing"
|
|
|
|
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
|
|
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
logrus.SetOutput(io.Discard)
|
|
|
|
m.Run()
|
|
}
|
|
|
|
// setupDB instantiates and returns a DB instance for the validator client.
|
|
func setupDB(t testing.TB, pubkeys [][fieldparams.BLSPubkeyLength]byte) *Store {
|
|
db, err := NewKVStore(context.Background(), t.TempDir(), &Config{
|
|
PubKeys: pubkeys,
|
|
})
|
|
require.NoError(t, err, "Failed to instantiate DB")
|
|
err = db.UpdatePublicKeysBuckets(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
|
|
}
|