mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 02:31:19 +00:00
36b6a71af4
* add flag to beacon and validator * gaz * fuzz * add dep viz * add to tools
25 lines
645 B
Go
25 lines
645 B
Go
package testing
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
|
"github.com/prysmaticlabs/prysm/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)
|
|
}
|
|
}
|