diff --git a/leveldb/cache/cache_test.go b/leveldb/cache/cache_test.go index cbd64f34..a0dfb384 100644 --- a/leveldb/cache/cache_test.go +++ b/leveldb/cache/cache_test.go @@ -200,6 +200,7 @@ func TestCacheMap(t *testing.T) { } // Emulate constant grow-shrink. + growShrinkStop := make(chan bool, 1) go func() { handles := make([]*Handle, 100000) for atomic.LoadInt32(&done) == 0 { @@ -212,6 +213,7 @@ func TestCacheMap(t *testing.T) { h.Release() } } + growShrinkStop <- true }() wg.Wait() @@ -237,6 +239,8 @@ func TestCacheMap(t *testing.T) { } } + <-growShrinkStop + require.Zero(t, c.Nodes()) require.Zero(t, c.Size()) t.Logf("STATS: %#v", c.GetStats())