From 8c90dc946a0eb765863eaa63cc8ccd8b5e6e9be1 Mon Sep 17 00:00:00 2001 From: aaronbuchwald Date: Wed, 29 Jun 2022 05:54:42 -0400 Subject: [PATCH] core/rawdb: simplify TestDiskSeek to use memorydb (#25182) --- core/state/snapshot/disklayer_test.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/core/state/snapshot/disklayer_test.go b/core/state/snapshot/disklayer_test.go index 689ed3877..f0c416be6 100644 --- a/core/state/snapshot/disklayer_test.go +++ b/core/state/snapshot/disklayer_test.go @@ -18,15 +18,11 @@ package snapshot import ( "bytes" - "io/ioutil" - "os" "testing" "github.com/VictoriaMetrics/fastcache" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethdb/leveldb" "github.com/ethereum/go-ethereum/ethdb/memorydb" "github.com/ethereum/go-ethereum/rlp" ) @@ -518,18 +514,7 @@ func TestDiskMidAccountPartialMerge(t *testing.T) { // TestDiskSeek tests that seek-operations work on the disk layer func TestDiskSeek(t *testing.T) { // Create some accounts in the disk layer - var db ethdb.Database - - if dir, err := ioutil.TempDir("", "disklayer-test"); err != nil { - t.Fatal(err) - } else { - defer os.RemoveAll(dir) - diskdb, err := leveldb.New(dir, 256, 0, "", false) - if err != nil { - t.Fatal(err) - } - db = rawdb.NewDatabase(diskdb) - } + db := rawdb.NewMemoryDatabase() // Fill even keys [0,2,4...] for i := 0; i < 0xff; i += 2 { acc := common.Hash{byte(i)}