mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 20:37:17 +00:00
1fbfd52e52
* att sign validations * eliminate old cached methods and use a simple approach in the db * redefined db methods * db package builds * add multilock to attest and propose * gaz * removed concurrency tests that are no longer relevant * add cache to db functions for attesting history checks * passing * add in feature flag --disable-attesting-history-db-cache * remove lock * Revert "remove lock" This reverts commit b1a65020e406b9fa6e4f57c5cc6a5a0b2a11a240. * comment * gaz
27 lines
643 B
Go
27 lines
643 B
Go
package testing
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/validator/db"
|
|
"github.com/prysmaticlabs/prysm/validator/db/kv"
|
|
)
|
|
|
|
// SetupDB instantiates and returns a DB instance for the validator client.
|
|
func SetupDB(t testing.TB, pubkeys [][48]byte) db.Database {
|
|
db, err := kv.NewKVStore(context.Background(), t.TempDir(), pubkeys)
|
|
if err != nil {
|
|
t.Fatalf("Failed to instantiate DB: %v", err)
|
|
}
|
|
t.Cleanup(func() {
|
|
if err := db.Close(); err != nil {
|
|
t.Fatalf("Failed to close database: %v", err)
|
|
}
|
|
if err := db.ClearDB(); err != nil {
|
|
t.Fatalf("Failed to clear database: %v", err)
|
|
}
|
|
})
|
|
return db
|
|
}
|