mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
c69bce5d84
* Use fieldparams for pubkey length * Fix validator tests * fix more tests * fix mock validator * Fix typo * bunch of typos * Update bytes.go * Update BUILD.bazel Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
34 lines
896 B
Go
34 lines
896 B
Go
package kv
|
|
|
|
import (
|
|
"context"
|
|
"io/ioutil"
|
|
"testing"
|
|
|
|
fieldparams "github.com/prysmaticlabs/prysm/config/fieldparams"
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
logrus.SetOutput(ioutil.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
|
|
}
|