mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
wrong test
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
fe1772f3c5
commit
6831f8d4a3
1 changed files with 0 additions and 36 deletions
|
|
@ -55,39 +55,3 @@ func TestHistoryIndexerShortenDeadlock(t *testing.T) {
|
||||||
t.Fatal("timed out waiting for shorten to complete, potential deadlock")
|
t.Fatal("timed out waiting for shorten to complete, potential deadlock")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestHistoryIndexerDeadLoop tests the specific scenario that causes
|
|
||||||
// dead loop when the metadata shows a higher value than the target.
|
|
||||||
func TestHistoryIndexerDeadLoop(t *testing.T) {
|
|
||||||
// log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelDebug, true)))
|
|
||||||
db := rawdb.NewMemoryDatabase()
|
|
||||||
freezer, _ := rawdb.NewStateFreezer(t.TempDir(), false, false)
|
|
||||||
defer freezer.Close()
|
|
||||||
|
|
||||||
histories := makeHistories(10)
|
|
||||||
for i, h := range histories {
|
|
||||||
accountData, storageData, accountIndex, storageIndex := h.encode()
|
|
||||||
rawdb.WriteStateHistory(freezer, uint64(i+1), h.meta.encode(), accountIndex, storageIndex, accountData, storageData)
|
|
||||||
}
|
|
||||||
|
|
||||||
storeIndexMetadata(db, 8) // Higher than our target of 5
|
|
||||||
|
|
||||||
// Create indexer with target that is less than the metadata
|
|
||||||
indexer := newHistoryIndexer(db, freezer, 5)
|
|
||||||
defer indexer.close()
|
|
||||||
|
|
||||||
// Wait for indexing to complete
|
|
||||||
timeout := time.After(5 * time.Second)
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-timeout:
|
|
||||||
t.Fatal("timed out waiting for indexing to complete")
|
|
||||||
default:
|
|
||||||
if indexer.inited() {
|
|
||||||
// Indexing completed successfully, no infinite loop occurred
|
|
||||||
return
|
|
||||||
}
|
|
||||||
time.Sleep(10 * time.Millisecond)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue