prysm-pulse/slasher/db/testing/setup_db_test.go
Raul Jordan 14e1f08208
Add Backup Webhooks to All Prysm Services With DBs (#8025)
* integrate backup webhooks

* pass slasher tests

* fix node

* cmd

* gaz

* read test passes

* radek feedback

* added comment

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
2020-12-03 22:28:57 +00:00

23 lines
673 B
Go

package testing
import (
"os"
"path/filepath"
"testing"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
slasherDB "github.com/prysmaticlabs/prysm/slasher/db"
"github.com/prysmaticlabs/prysm/slasher/db/kv"
)
func TestClearDB(t *testing.T) {
// Setting up manually is required, since SetupDB() will also register a teardown procedure.
cfg := &kv.Config{}
db, err := slasherDB.NewDB(t.TempDir(), cfg)
require.NoError(t, err, "Failed to instantiate DB")
db.EnableSpanCache(false)
require.NoError(t, db.ClearDB())
_, err = os.Stat(filepath.Join(db.DatabasePath(), "slasher.db"))
require.Equal(t, true, os.IsNotExist(err), "Db wasnt cleared %v", err)
}