From f7ce7a48ddcb3231f7a7644080ca8a01fec1d89a Mon Sep 17 00:00:00 2001 From: i-norden Date: Mon, 11 Oct 2021 10:18:45 -0500 Subject: [PATCH] fix unit tests after updating deps --- pkg/util.go | 4 ++-- pkg/validator.go | 8 ++++++++ pkg/validator_test.go | 11 +++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pkg/util.go b/pkg/util.go index 0f8e212..b9bdb2e 100644 --- a/pkg/util.go +++ b/pkg/util.go @@ -21,8 +21,8 @@ import ( "github.com/ipfs/go-blockservice" "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipfs-blockstore" - "github.com/ipfs/go-ipfs-ds-help" + blockstore "github.com/ipfs/go-ipfs-blockstore" + dshelp "github.com/ipfs/go-ipfs-ds-help" "github.com/ipfs/go-ipfs/core" "github.com/ipfs/go-ipfs/repo/fsrepo" "github.com/jmoiron/sqlx" diff --git a/pkg/validator.go b/pkg/validator.go index d80aab4..6c93d73 100644 --- a/pkg/validator.go +++ b/pkg/validator.go @@ -138,3 +138,11 @@ func (v *Validator) ValidateStorageTrie(address common.Address, storageRoot comm } return it.Error() } + +// Close implements io.Closer +// it deregisters the groupcache name +func (v *Validator) Close() error { + groupcache.DeregisterGroup("kv") + groupcache.DeregisterGroup("db") + return nil +} diff --git a/pkg/validator_test.go b/pkg/validator_test.go index 2cefad3..9b638d2 100644 --- a/pkg/validator_test.go +++ b/pkg/validator_test.go @@ -24,14 +24,14 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/rlp" - "github.com/ipfs/go-cid/_rsrch/cidiface" + cid "github.com/ipfs/go-cid/_rsrch/cidiface" "github.com/jmoiron/sqlx" "github.com/multiformats/go-multihash" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/vulcanize/eth-ipfs-state-validator/pkg" - "github.com/vulcanize/ipfs-ethdb/postgres" + validator "github.com/vulcanize/eth-ipfs-state-validator/pkg" + pgipfsethdb "github.com/vulcanize/ipfs-ethdb/postgres" ) var ( @@ -201,6 +201,9 @@ var _ = Describe("PG-IPFS Validator", func() { Expect(err).ToNot(HaveOccurred()) v = validator.NewPGIPFSValidator(db) }) + AfterEach(func() { + v.Close() + }) Describe("ValidateTrie", func() { AfterEach(func() { err = validator.ResetTestDB(db) @@ -236,7 +239,7 @@ var _ = Describe("PG-IPFS Validator", func() { loadTrie(trieStateNodes, trieStorageNodes) err = v.ValidateTrie(stateRoot) Expect(err).To(HaveOccurred()) - subStr := fmt.Sprintf("code %s: sql: no rows in result set", codeHash.Hex()[2:]) + subStr := fmt.Sprintf("code %s: not found", codeHash.Hex()[2:]) Expect(err.Error()).To(ContainSubstring(subStr)) }) It("Returns no error if the entire state (state trie and storage tries) can be validated", func() {