prysm-pulse/slasher/db/setup_db_test.go

25 lines
457 B
Go
Raw Normal View History

2019-09-26 16:29:10 +00:00
package db
import (
"flag"
2019-09-26 16:29:10 +00:00
"os"
"testing"
"github.com/urfave/cli"
2019-09-26 16:29:10 +00:00
)
func TestClearDB(t *testing.T) {
app := cli.NewApp()
set := flag.NewFlagSet("test", 0)
ctx := cli.NewContext(app, set, nil)
slasherDB := SetupSlasherDB(t, ctx)
2019-09-26 16:29:10 +00:00
defer TeardownSlasherDB(t, slasherDB)
if err := slasherDB.ClearDB(); err != nil {
t.Fatal(err)
}
if _, err := os.Stat(slasherDB.DatabasePath()); !os.IsNotExist(err) {
t.Fatalf("db wasnt cleared %v", err)
}
}