From d5da02a4308befbe9b533435bbba21894789024d Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Thu, 19 Jun 2025 14:08:36 +0800 Subject: [PATCH] triedb/pathdb: fix tests Signed-off-by: jsvisa --- triedb/pathdb/database_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/triedb/pathdb/database_test.go b/triedb/pathdb/database_test.go index fb1bf57e9d..e05cdfc632 100644 --- a/triedb/pathdb/database_test.go +++ b/triedb/pathdb/database_test.go @@ -23,6 +23,7 @@ import ( "math/rand" "os" "path/filepath" + "strconv" "testing" "github.com/ethereum/go-ethereum/common" @@ -615,7 +616,7 @@ func TestCommit(t *testing.T) { func TestJournal(t *testing.T) { testJournal(t, "") - testJournal(t, t.TempDir()) + testJournal(t, filepath.Join(t.TempDir(), strconv.Itoa(rand.Intn(10000)))) } func testJournal(t *testing.T, journal string) { @@ -632,7 +633,7 @@ func testJournal(t *testing.T, journal string) { t.Errorf("Failed to journal, err: %v", err) } tester.db.Close() - tester.db = New(tester.db.diskdb, nil, false) + tester.db = New(tester.db.diskdb, tester.db.config, false) // Verify states including disk layer and all diff on top. for i := 0; i < len(tester.roots); i++ { @@ -656,7 +657,7 @@ func TestCorruptedJournal(t *testing.T) { rawdb.WriteTrieJournal(db, blob) }) - path := filepath.Join(t.TempDir(), "journal") + path := filepath.Join(t.TempDir(), strconv.Itoa(rand.Intn(10000))) testCorruptedJournal(t, path, func(_ ethdb.Database) { f, _ := os.OpenFile(path, os.O_WRONLY, 0644) f.WriteAt([]byte{0xa}, 0)