瀏覽代碼

eth: increase timeout in TestBroadcastBlock (#21299)

Martin Holst Swende 5 年之前
父節點
當前提交
5b1cfdef89
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      eth/handler_test.go

+ 6 - 3
eth/handler_test.go

@@ -614,13 +614,16 @@ func testBroadcastBlock(t *testing.T, totalPeers, broadcastExpected int) {
 		select {
 		case <-doneCh:
 			received++
-
-		case <-time.After(time.Second):
+			if received > broadcastExpected {
+				// We can bail early here
+				t.Errorf("broadcast count mismatch: have %d > want %d", received, broadcastExpected)
+				return
+			}
+		case <-time.After(2 * time.Second):
 			if received != broadcastExpected {
 				t.Errorf("broadcast count mismatch: have %d, want %d", received, broadcastExpected)
 			}
 			return
-
 		case err = <-errCh:
 			t.Fatalf("broadcast failed: %v", err)
 		}