mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-06 22:23:56 -05:00
* Update to Go 1.23 * Update bazel version * Update rules_go * Use toolchains_protoc * Update go_honnef_go_tools * Update golang.org/x/tools * Fix violations of SA3000 * Update errcheck by re-exporting the upstream repo * Remove problematic ginkgo and gomega test helpers. Rewrote tests without these test libraries. * Update go to 1.23.5 * gofmt with go1.23.5 * Revert Patch * Unclog * Update for go 1.23 support * Fix Lint Issues * Gazelle * Fix Build * Fix Lint * no lint * Fix lint * Fix lint * Disable intrange * Preston's review --------- Co-authored-by: Preston Van Loon <preston@pvl.dev>
35 lines
906 B
Go
35 lines
906 B
Go
package kv
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"os"
|
|
"testing"
|
|
|
|
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
|
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
logrus.SetOutput(io.Discard)
|
|
|
|
os.Exit(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
|
|
}
|