prysm-pulse/validator/db/testing/setup_db_test.go
terence 5a66807989
Update to V5 (#13622)
* First take at updating everything to v5

* Patch gRPC gateway to use prysm v5

Fix patch

* Update go ssz

---------

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
2024-02-15 05:46:47 +00:00

25 lines
643 B
Go

package testing
import (
"context"
"os"
"path/filepath"
"testing"
"github.com/prysmaticlabs/prysm/v5/testing/require"
"github.com/prysmaticlabs/prysm/v5/validator/db/kv"
)
func TestClearDB(t *testing.T) {
// Setting up manually is required, since SetupDB() will also register a teardown procedure.
testDB, err := kv.NewKVStore(context.Background(), t.TempDir(), &kv.Config{
PubKeys: nil,
})
require.NoError(t, err, "Failed to instantiate DB")
require.NoError(t, testDB.ClearDB())
if _, err := os.Stat(filepath.Join(testDB.DatabasePath(), "validator.db")); !os.IsNotExist(err) {
t.Fatalf("DB was not cleared: %v", err)
}
}