mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +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
25 lines
643 B
Go
25 lines
643 B
Go
package testing
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
|
"github.com/prysmaticlabs/prysm/v4/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)
|
|
}
|
|
}
|