From 51387aaea00b2cbd02b1ede6411086e7e9f6cc00 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Fri, 13 Apr 2018 15:32:16 +0300 Subject: [PATCH] swarm/storage: add sleep to wait for gc --- swarm/storage/ldbstore_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/swarm/storage/ldbstore_test.go b/swarm/storage/ldbstore_test.go index 0d560d5187..bf97b3ab65 100644 --- a/swarm/storage/ldbstore_test.go +++ b/swarm/storage/ldbstore_test.go @@ -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 {