Skip to content

Commit

Permalink
consensus/ethash: increase timeout in test (ethereum#17526)
Browse files Browse the repository at this point in the history
This is an attempt to fix the flaky consensus/ethash tests under macOS.
  • Loading branch information
nonsense authored and cryptomental committed Jan 9, 2019
1 parent 5138fb3 commit 9f0ad65
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions consensus/ethash/sealer_test.go
Expand Up @@ -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()
Expand All @@ -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")
}
}
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 9f0ad65

Please sign in to comment.