swarm/storage: fix test timeout with -race by increasing mget timeout

`go test -race` might significantly increase test run time (~2-10x).
`-race` caused the following tests to time out both locally and on
the CI. So I doubled the timeout.

--- FAIL: TestDbStoreCorrect_1k (16.88s)
    common_test.go:193: testStore failed: timed out after 5 seconds
--- FAIL: TestMockDbStoreCorrect_1k (20.54s)
    common_test.go:193: testStore failed: timed out after 5 seconds

Note: The unit for time ('s') will be appended automatically by
`fmt.Errorf()`.
This commit is contained in:
Ferenc Szabo 2019-02-05 13:37:09 +01:00
parent f413a3dbb2
commit 7927fef9a8

View file

@ -142,10 +142,11 @@ func mget(store ChunkStore, hs []Address, f func(h Address, chunk Chunk) error)
close(errc)
}()
var err error
timeout := 10 * time.Second
select {
case err = <-errc:
case <-time.NewTimer(5 * time.Second).C:
err = fmt.Errorf("timed out after 5 seconds")
case <-time.NewTimer(timeout).C:
err = fmt.Errorf("timed out after %v", timeout)
}
return err
}