swarm/storage: increase mput timeout for TestCleanIndex

The following test failed with `-race` flag on Travis.

--- FAIL: TestCleanIndex (43.85s)
    ldbstore_test.go:757: context deadline exceeded

As `-race` can increase the run time by 10x.

Alternative: we could just to increase the timeout for the
specific test. As currently the timeout is hardcoded and (strangely)
does not depend on the size of 'n'. That could be achieved by adding
a new function mputWithCustomTimeout(), but then we should keep
symmetry and add custom timeout for mget(), too. But I think the
method already has too many parameters and might be replaced by
the ongoing storage rewrite. So I won't do.
This commit is contained in:
Ferenc Szabo 2019-02-07 13:34:42 +01:00
parent 500a9fbbbb
commit 2102dec3f3

View file

@ -91,7 +91,7 @@ func mput(store ChunkStore, n int, f func(i int64) Chunk) (hs []Chunk, err error
// put to localstore and wait for stored channel // put to localstore and wait for stored channel
// does not check delivery error state // does not check delivery error state
errc := make(chan error) errc := make(chan error)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel() defer cancel()
for i := int64(0); i < int64(n); i++ { for i := int64(0); i < int64(n); i++ {
chunk := f(ch.DefaultSize) chunk := f(ch.DefaultSize)