diff --git a/postgres/batch_test.go b/postgres/batch_test.go index 54bbd9e..828ad98 100644 --- a/postgres/batch_test.go +++ b/postgres/batch_test.go @@ -23,6 +23,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/rlp" + "github.com/mailgun/groupcache/v2" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -51,6 +52,7 @@ var _ = Describe("Batch", func() { batch = database.NewBatch() }) AfterEach(func() { + groupcache.DeregisterGroup("db") err = pgipfsethdb.ResetTestDB(db) Expect(err).ToNot(HaveOccurred()) }) diff --git a/postgres/database_test.go b/postgres/database_test.go index 9e407e7..cd58bc8 100644 --- a/postgres/database_test.go +++ b/postgres/database_test.go @@ -24,6 +24,7 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/rlp" "github.com/jmoiron/sqlx" + "github.com/mailgun/groupcache/v2" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -54,6 +55,7 @@ var _ = Describe("Database", func() { database = pgipfsethdb.NewDatabase(db, cacheConfig) }) AfterEach(func() { + groupcache.DeregisterGroup("db") err = pgipfsethdb.ResetTestDB(db) Expect(err).ToNot(HaveOccurred()) }) diff --git a/postgres/util.go b/postgres/util.go index 69e9cdf..eedd8fd 100644 --- a/postgres/util.go +++ b/postgres/util.go @@ -44,6 +44,6 @@ func TestDB() (*sqlx.DB, error) { // ResetTestDB drops all rows in the test db public.blocks table func ResetTestDB(db *sqlx.DB) error { - _, err := db.Exec("TRUNCATE public.blocks") + _, err := db.Exec("TRUNCATE public.blocks CASCADE") return err }