Skip to content

Commit dd09af2

Browse files
committed
eth/downloader: run tests in parallel
1 parent b7b62d4 commit dd09af2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

eth/downloader/downloader_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,8 @@ func TestCanonicalSynchronisation64Fast(t *testing.T) { testCanonicalSynchronis
691691
func TestCanonicalSynchronisation64Light(t *testing.T) { testCanonicalSynchronisation(t, 64, LightSync) }
692692

693693
func testCanonicalSynchronisation(t *testing.T, protocol int, mode SyncMode) {
694+
t.Parallel()
695+
694696
// Create a small enough block chain to download
695697
targetBlocks := blockCacheLimit - 15
696698
hashes, headers, blocks, receipts := makeChain(targetBlocks, 0, genesis, nil)
@@ -715,6 +717,8 @@ func TestThrottling64Full(t *testing.T) { testThrottling(t, 64, FullSync) }
715717
func TestThrottling64Fast(t *testing.T) { testThrottling(t, 64, FastSync) }
716718

717719
func testThrottling(t *testing.T, protocol int, mode SyncMode) {
720+
t.Parallel()
721+
718722
// Create a long block chain to download and the tester
719723
targetBlocks := 8 * blockCacheLimit
720724
hashes, headers, blocks, receipts := makeChain(targetBlocks, 0, genesis, nil)
@@ -800,6 +804,8 @@ func TestForkedSynchronisation64Fast(t *testing.T) { testForkedSynchronisation(
800804
func TestForkedSynchronisation64Light(t *testing.T) { testForkedSynchronisation(t, 64, LightSync) }
801805

802806
func testForkedSynchronisation(t *testing.T, protocol int, mode SyncMode) {
807+
t.Parallel()
808+
803809
// Create a long enough forked chain
804810
common, fork := MaxHashFetch, 2*MaxHashFetch
805811
hashesA, hashesB, headersA, headersB, blocksA, blocksB, receiptsA, receiptsB := makeChainFork(common+fork, fork, genesis, nil)
@@ -823,6 +829,7 @@ func testForkedSynchronisation(t *testing.T, protocol int, mode SyncMode) {
823829

824830
// Tests that an inactive downloader will not accept incoming hashes and blocks.
825831
func TestInactiveDownloader61(t *testing.T) {
832+
t.Parallel()
826833
tester := newTester()
827834

828835
// Check that neither hashes nor blocks are accepted
@@ -837,6 +844,7 @@ func TestInactiveDownloader61(t *testing.T) {
837844
// Tests that an inactive downloader will not accept incoming block headers and
838845
// bodies.
839846
func TestInactiveDownloader62(t *testing.T) {
847+
t.Parallel()
840848
tester := newTester()
841849

842850
// Check that neither block headers nor bodies are accepted
@@ -851,6 +859,7 @@ func TestInactiveDownloader62(t *testing.T) {
851859
// Tests that an inactive downloader will not accept incoming block headers,
852860
// bodies and receipts.
853861
func TestInactiveDownloader63(t *testing.T) {
862+
t.Parallel()
854863
tester := newTester()
855864

856865
// Check that neither block headers nor bodies are accepted
@@ -875,6 +884,8 @@ func TestCancel64Fast(t *testing.T) { testCancel(t, 64, FastSync) }
875884
func TestCancel64Light(t *testing.T) { testCancel(t, 64, LightSync) }
876885

877886
func testCancel(t *testing.T, protocol int, mode SyncMode) {
887+
t.Parallel()
888+
878889
// Create a small enough block chain to download and the tester
879890
targetBlocks := blockCacheLimit - 15
880891
if targetBlocks >= MaxHashFetch {
@@ -913,6 +924,8 @@ func TestMultiSynchronisation64Fast(t *testing.T) { testMultiSynchronisation(t,
913924
func TestMultiSynchronisation64Light(t *testing.T) { testMultiSynchronisation(t, 64, LightSync) }
914925

915926
func testMultiSynchronisation(t *testing.T, protocol int, mode SyncMode) {
927+
t.Parallel()
928+
916929
// Create various peers with various parts of the chain
917930
targetPeers := 8
918931
targetBlocks := targetPeers*blockCacheLimit - 15
@@ -940,6 +953,8 @@ func TestMultiProtoSynchronisation64Fast(t *testing.T) { testMultiProtoSync(t,
940953
func TestMultiProtoSynchronisation64Light(t *testing.T) { testMultiProtoSync(t, 64, LightSync) }
941954

942955
func testMultiProtoSync(t *testing.T, protocol int, mode SyncMode) {
956+
t.Parallel()
957+
943958
// Create a small enough block chain to download
944959
targetBlocks := blockCacheLimit - 15
945960
hashes, headers, blocks, receipts := makeChain(targetBlocks, 0, genesis, nil)
@@ -976,6 +991,8 @@ func TestEmptyShortCircuit64Fast(t *testing.T) { testEmptyShortCircuit(t, 64, F
976991
func TestEmptyShortCircuit64Light(t *testing.T) { testEmptyShortCircuit(t, 64, LightSync) }
977992

978993
func testEmptyShortCircuit(t *testing.T, protocol int, mode SyncMode) {
994+
t.Parallel()
995+
979996
// Create a block chain to download
980997
targetBlocks := 2*blockCacheLimit - 15
981998
hashes, headers, blocks, receipts := makeChain(targetBlocks, 0, genesis, nil)
@@ -1027,6 +1044,8 @@ func TestMissingHeaderAttack64Fast(t *testing.T) { testMissingHeaderAttack(t, 6
10271044
func TestMissingHeaderAttack64Light(t *testing.T) { testMissingHeaderAttack(t, 64, LightSync) }
10281045

10291046
func testMissingHeaderAttack(t *testing.T, protocol int, mode SyncMode) {
1047+
t.Parallel()
1048+
10301049
// Create a small enough block chain to download
10311050
targetBlocks := blockCacheLimit - 15
10321051
hashes, headers, blocks, receipts := makeChain(targetBlocks, 0, genesis, nil)
@@ -1178,6 +1197,8 @@ func TestHighTDStarvationAttack64Fast(t *testing.T) { testHighTDStarvationAttac
11781197
func TestHighTDStarvationAttack64Light(t *testing.T) { testHighTDStarvationAttack(t, 64, LightSync) }
11791198

11801199
func testHighTDStarvationAttack(t *testing.T, protocol int, mode SyncMode) {
1200+
t.Parallel()
1201+
11811202
tester := newTester()
11821203
hashes, headers, blocks, receipts := makeChain(0, 0, genesis, nil)
11831204

@@ -1252,6 +1273,8 @@ func TestSyncProgress64Fast(t *testing.T) { testSyncProgress(t, 64, FastSync) }
12521273
func TestSyncProgress64Light(t *testing.T) { testSyncProgress(t, 64, LightSync) }
12531274

12541275
func testSyncProgress(t *testing.T, protocol int, mode SyncMode) {
1276+
t.Parallel()
1277+
12551278
// Create a small enough block chain to download
12561279
targetBlocks := blockCacheLimit - 15
12571280
hashes, headers, blocks, receipts := makeChain(targetBlocks, 0, genesis, nil)
@@ -1322,6 +1345,8 @@ func TestForkedSyncProgress64Fast(t *testing.T) { testForkedSyncProgress(t, 64,
13221345
func TestForkedSyncProgress64Light(t *testing.T) { testForkedSyncProgress(t, 64, LightSync) }
13231346

13241347
func testForkedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
1348+
t.Parallel()
1349+
13251350
// Create a forked chain to simulate origin revertal
13261351
common, fork := MaxHashFetch, 2*MaxHashFetch
13271352
hashesA, hashesB, headersA, headersB, blocksA, blocksB, receiptsA, receiptsB := makeChainFork(common+fork, fork, genesis, nil)
@@ -1395,6 +1420,8 @@ func TestFailedSyncProgress64Fast(t *testing.T) { testFailedSyncProgress(t, 64,
13951420
func TestFailedSyncProgress64Light(t *testing.T) { testFailedSyncProgress(t, 64, LightSync) }
13961421

13971422
func testFailedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
1423+
t.Parallel()
1424+
13981425
// Create a small enough block chain to download
13991426
targetBlocks := blockCacheLimit - 15
14001427
hashes, headers, blocks, receipts := makeChain(targetBlocks, 0, genesis, nil)
@@ -1469,6 +1496,8 @@ func TestFakedSyncProgress64Fast(t *testing.T) { testFakedSyncProgress(t, 64, F
14691496
func TestFakedSyncProgress64Light(t *testing.T) { testFakedSyncProgress(t, 64, LightSync) }
14701497

14711498
func testFakedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
1499+
t.Parallel()
1500+
14721501
// Create a small block chain
14731502
targetBlocks := blockCacheLimit - 15
14741503
hashes, headers, blocks, receipts := makeChain(targetBlocks+3, 0, genesis, nil)

0 commit comments

Comments
 (0)