diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2018-09-03 22:59:23 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2018-09-03 22:59:23 +0800 |
commit | cc2b39bbd18a8f67ac9ceca9ee8eabfc72d0b14b (patch) | |
tree | bccf78cc8f80cfb439fbde1f17732f7da6c0d704 /consensus/ethash/sealer_test.go | |
parent | c9a0b36a5f89797672facdb2983600e22ecf6417 (diff) | |
download | go-tangerine-cc2b39bbd18a8f67ac9ceca9ee8eabfc72d0b14b.tar go-tangerine-cc2b39bbd18a8f67ac9ceca9ee8eabfc72d0b14b.tar.gz go-tangerine-cc2b39bbd18a8f67ac9ceca9ee8eabfc72d0b14b.tar.bz2 go-tangerine-cc2b39bbd18a8f67ac9ceca9ee8eabfc72d0b14b.tar.lz go-tangerine-cc2b39bbd18a8f67ac9ceca9ee8eabfc72d0b14b.tar.xz go-tangerine-cc2b39bbd18a8f67ac9ceca9ee8eabfc72d0b14b.tar.zst go-tangerine-cc2b39bbd18a8f67ac9ceca9ee8eabfc72d0b14b.zip |
consensus/ethash: increase timeout in test (#17526)
This is an attempt to fix the flaky consensus/ethash tests under macOS.
Diffstat (limited to 'consensus/ethash/sealer_test.go')
-rw-r--r-- | consensus/ethash/sealer_test.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/consensus/ethash/sealer_test.go b/consensus/ethash/sealer_test.go index 31d18b67c..436359af7 100644 --- a/consensus/ethash/sealer_test.go +++ b/consensus/ethash/sealer_test.go @@ -40,6 +40,18 @@ func TestRemoteNotify(t *testing.T) { go server.Serve(listener) + // Wait for server to start listening + var tries int + for tries = 0; tries < 10; tries++ { + conn, _ := net.DialTimeout("tcp", listener.Addr().String(), 1*time.Second) + if conn != nil { + break + } + } + if tries == 10 { + t.Fatal("tcp listener not ready for more than 10 seconds") + } + // Create the custom ethash engine ethash := NewTester([]string{"http://" + listener.Addr().String()}, false) defer ethash.Close() @@ -61,7 +73,7 @@ func TestRemoteNotify(t *testing.T) { if want := common.BytesToHash(target.Bytes()).Hex(); work[2] != want { t.Errorf("work packet target mismatch: have %s, want %s", work[2], want) } - case <-time.After(time.Second): + case <-time.After(3 * time.Second): t.Fatalf("notification timed out") } } @@ -108,7 +120,7 @@ func TestRemoteMultiNotify(t *testing.T) { for i := 0; i < cap(sink); i++ { select { case <-sink: - case <-time.After(250 * time.Millisecond): + case <-time.After(3 * time.Second): t.Fatalf("notification %d timed out", i) } } |