From 7927fef9a8f1ad861388a493f33f0b3f119f8936 Mon Sep 17 00:00:00 2001 From: Ferenc Szabo Date: Tue, 5 Feb 2019 13:37:09 +0100 Subject: [PATCH] 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()`. --- swarm/storage/common_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/swarm/storage/common_test.go b/swarm/storage/common_test.go index bcc29d8cc7..6c737af44e 100644 --- a/swarm/storage/common_test.go +++ b/swarm/storage/common_test.go @@ -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 }