From aae2cba8ce782cc4e319944253ff4d7feea3eb92 Mon Sep 17 00:00:00 2001 From: i-norden Date: Wed, 29 Dec 2021 00:17:52 -0600 Subject: [PATCH] fix tests failing from the recent groupcache changes --- postgres/batch_test.go | 2 ++ postgres/database_test.go | 2 ++ postgres/util.go | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) 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 }