prysm-pulse/slasher/db/testing/setup_db_test.go

24 lines
450 B
Go
Raw Normal View History

package testing
2019-09-26 16:29:10 +00:00
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)
slasherDB := SetupSlasherDB(t, cli.NewContext(app, set, nil))
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)
}
}