From f0b5eb09eb30545b11ad5c0179517fc2159ad02d Mon Sep 17 00:00:00 2001
From: gary rong <garyrong0905@gmail.com>
Date: Tue, 7 Apr 2020 14:16:21 +0800
Subject: [PATCH] eth, les: fix flaky tests (#20897)

* les: fix flaky test

* eth: fix flaky test
---
 eth/handler_test.go | 2 +-
 les/peer_test.go    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/eth/handler_test.go b/eth/handler_test.go
index 5914f4c64..e5449c342 100644
--- a/eth/handler_test.go
+++ b/eth/handler_test.go
@@ -615,7 +615,7 @@ func testBroadcastBlock(t *testing.T, totalPeers, broadcastExpected int) {
 		case <-doneCh:
 			received++
 
-		case <-time.After(100 * time.Millisecond):
+		case <-time.After(time.Second):
 			if received != broadcastExpected {
 				t.Errorf("broadcast count mismatch: have %d, want %d", received, broadcastExpected)
 			}
diff --git a/les/peer_test.go b/les/peer_test.go
index 59a2ad700..8309e3557 100644
--- a/les/peer_test.go
+++ b/les/peer_test.go
@@ -140,7 +140,7 @@ func TestHandshake(t *testing.T) {
 			if err != nil {
 				t.Fatalf("handshake failed, %v", err)
 			}
-		case <-time.NewTimer(100 * time.Millisecond).C:
+		case <-time.After(time.Second):
 			t.Fatalf("timeout")
 		}
 	}
-- 
GitLab