fix tests failing from the recent groupcache changes

This commit is contained in:
i-norden 2021-12-29 00:17:52 -06:00
parent 9db42029f7
commit aae2cba8ce
3 changed files with 5 additions and 1 deletions

View File

@ -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())
})

View File

@ -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())
})

View File

@ -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
}