mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
swarm/storage: add sleep to wait for gc
This commit is contained in:
parent
ce3d732c4a
commit
51387aaea0
1 changed files with 6 additions and 2 deletions
|
|
@ -23,6 +23,7 @@ import (
|
|||
"os"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
|
|
@ -340,7 +341,7 @@ func TestLDBStoreCollectGarbage(t *testing.T) {
|
|||
for i := 0; i < n; i++ {
|
||||
c := NewRandomChunk(chunkSize)
|
||||
chunks = append(chunks, c)
|
||||
log.Info("generate random chunk", "idx", i, "chunk", c)
|
||||
log.Trace("generate random chunk", "idx", i, "chunk", c)
|
||||
}
|
||||
|
||||
for i := 0; i < n; i++ {
|
||||
|
|
@ -354,6 +355,9 @@ func TestLDBStoreCollectGarbage(t *testing.T) {
|
|||
|
||||
log.Info("ldbstore", "entrycnt", ldb.entryCnt, "accesscnt", ldb.accessCnt)
|
||||
|
||||
// wait for garbage collection to kick in on the responsible actor
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
var missing int
|
||||
for i := 0; i < n; i++ {
|
||||
ret, err := ldb.Get(chunks[i].Key)
|
||||
|
|
@ -369,7 +373,7 @@ func TestLDBStoreCollectGarbage(t *testing.T) {
|
|||
t.Fatal("expected to get the same data back, but got smth else")
|
||||
}
|
||||
|
||||
log.Info("got back chunk", "chunk", ret)
|
||||
log.Trace("got back chunk", "chunk", ret)
|
||||
}
|
||||
|
||||
if missing < n-capacity {
|
||||
|
|
|
|||
Loading…
Reference in a new issue