give the TimeCacheBS tests a bit more time

Otherwise, they flake once in a while.
This commit is contained in:
Steven Allen 2020-10-14 16:51:26 -07:00
parent 7ccb2aabf0
commit 86e30729bf

View File

@ -14,7 +14,7 @@ import (
) )
func TestTimedBSSimple(t *testing.T) { func TestTimedBSSimple(t *testing.T) {
tc := timedbs.NewTimedCacheBS(3 * time.Millisecond) tc := timedbs.NewTimedCacheBS(10 * time.Millisecond)
_ = tc.Start(context.Background()) _ = tc.Start(context.Background())
defer func() { defer func() {
_ = tc.Stop(context.Background()) _ = tc.Stop(context.Background())
@ -36,7 +36,7 @@ func TestTimedBSSimple(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.True(t, has) require.True(t, has)
time.Sleep(4 * time.Millisecond) time.Sleep(15 * time.Millisecond)
// We should still have everything. // We should still have everything.
has, err = tc.Has(b1.Cid()) has, err = tc.Has(b1.Cid())
@ -60,7 +60,7 @@ func TestTimedBSSimple(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.ElementsMatch(t, ks, []cid.Cid{b1.Cid(), b2.Cid(), b3.Cid()}) require.ElementsMatch(t, ks, []cid.Cid{b1.Cid(), b2.Cid(), b3.Cid()})
time.Sleep(4 * time.Millisecond) time.Sleep(10 * time.Millisecond)
// should still have b2, and b3, but not b1 // should still have b2, and b3, but not b1