mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 07:37:20 +00:00
core/state: fix the flaky TestSizeTracker (#32993)
This commit is contained in:
parent
6608a2aafd
commit
3b8075234e
1 changed files with 14 additions and 7 deletions
|
|
@ -94,6 +94,14 @@ func TestSizeTracker(t *testing.T) {
|
|||
}
|
||||
baselineRoot := currentRoot
|
||||
|
||||
// Close and reopen the trie database so all async flushes triggered by the
|
||||
// baseline commits are written before we measure the baseline snapshot.
|
||||
if err := tdb.Close(); err != nil {
|
||||
t.Fatalf("Failed to close triedb before baseline measurement: %v", err)
|
||||
}
|
||||
tdb = triedb.NewDatabase(db, &triedb.Config{PathDB: pathdb.Defaults})
|
||||
sdb = NewDatabase(tdb, nil)
|
||||
|
||||
// Wait for snapshot completion
|
||||
for !tdb.SnapshotCompleted() {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
|
@ -215,13 +223,12 @@ func TestSizeTracker(t *testing.T) {
|
|||
if actualStats.ContractCodeBytes != expectedStats.ContractCodeBytes {
|
||||
t.Errorf("Contract code bytes mismatch: expected %d, got %d", expectedStats.ContractCodeBytes, actualStats.ContractCodeBytes)
|
||||
}
|
||||
// TODO: failed on github actions, need to investigate
|
||||
// if actualStats.AccountTrienodes != expectedStats.AccountTrienodes {
|
||||
// t.Errorf("Account trie nodes mismatch: expected %d, got %d", expectedStats.AccountTrienodes, actualStats.AccountTrienodes)
|
||||
// }
|
||||
// if actualStats.AccountTrienodeBytes != expectedStats.AccountTrienodeBytes {
|
||||
// t.Errorf("Account trie node bytes mismatch: expected %d, got %d", expectedStats.AccountTrienodeBytes, actualStats.AccountTrienodeBytes)
|
||||
// }
|
||||
if actualStats.AccountTrienodes != expectedStats.AccountTrienodes {
|
||||
t.Errorf("Account trie nodes mismatch: expected %d, got %d", expectedStats.AccountTrienodes, actualStats.AccountTrienodes)
|
||||
}
|
||||
if actualStats.AccountTrienodeBytes != expectedStats.AccountTrienodeBytes {
|
||||
t.Errorf("Account trie node bytes mismatch: expected %d, got %d", expectedStats.AccountTrienodeBytes, actualStats.AccountTrienodeBytes)
|
||||
}
|
||||
if actualStats.StorageTrienodes != expectedStats.StorageTrienodes {
|
||||
t.Errorf("Storage trie nodes mismatch: expected %d, got %d", expectedStats.StorageTrienodes, actualStats.StorageTrienodes)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue