Skip to content

Commit 5c93488

Browse files
feat(lib/grandpa): include t.Parallel() to all lib/grandpa tests (#2840)
Co-authored-by: Timothy Wu <[email protected]>
1 parent a1602bc commit 5c93488

7 files changed

+127
-3
lines changed

lib/grandpa/grandpa.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ type Service struct {
7777

7878
// channels for communication with other services
7979
finalisedCh chan *types.FinalisationInfo
80+
//receivedCommit chan *CommitMessage
8081

8182
telemetry telemetry.Client
8283
}

lib/grandpa/grandpa_integration_test.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
)
2323

2424
func TestUpdateAuthorities(t *testing.T) {
25+
t.Parallel()
26+
2527
kr, err := keystore.NewEd25519Keyring()
2628
require.NoError(t, err)
2729
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -50,6 +52,8 @@ func TestUpdateAuthorities(t *testing.T) {
5052
}
5153

5254
func TestGetDirectVotes(t *testing.T) {
55+
t.Parallel()
56+
5357
kr, err := keystore.NewEd25519Keyring()
5458
require.NoError(t, err)
5559
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -87,6 +91,8 @@ func TestGetDirectVotes(t *testing.T) {
8791
}
8892

8993
func TestGetVotesForBlock_NoDescendantVotes(t *testing.T) {
94+
t.Parallel()
95+
9096
kr, err := keystore.NewEd25519Keyring()
9197
require.NoError(t, err)
9298
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -127,6 +133,8 @@ func TestGetVotesForBlock_NoDescendantVotes(t *testing.T) {
127133
}
128134

129135
func TestGetVotesForBlock_DescendantVotes(t *testing.T) {
136+
t.Parallel()
137+
130138
kr, err := keystore.NewEd25519Keyring()
131139
require.NoError(t, err)
132140
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -181,6 +189,8 @@ func TestGetVotesForBlock_DescendantVotes(t *testing.T) {
181189
}
182190

183191
func TestGetPossibleSelectedAncestors_SameAncestor(t *testing.T) {
192+
t.Parallel()
193+
184194
kr, err := keystore.NewEd25519Keyring()
185195
require.NoError(t, err)
186196
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -239,6 +249,8 @@ func TestGetPossibleSelectedAncestors_SameAncestor(t *testing.T) {
239249
}
240250

241251
func TestGetPossibleSelectedAncestors_VaryingAncestor(t *testing.T) {
252+
t.Parallel()
253+
242254
kr, err := keystore.NewEd25519Keyring()
243255
require.NoError(t, err)
244256
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -297,6 +309,8 @@ func TestGetPossibleSelectedAncestors_VaryingAncestor(t *testing.T) {
297309
}
298310

299311
func TestGetPossibleSelectedAncestors_VaryingAncestor_MoreBranches(t *testing.T) {
312+
t.Parallel()
313+
300314
kr, err := keystore.NewEd25519Keyring()
301315
require.NoError(t, err)
302316
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -361,6 +375,8 @@ func TestGetPossibleSelectedAncestors_VaryingAncestor_MoreBranches(t *testing.T)
361375
}
362376

363377
func TestGetPossibleSelectedBlocks_OneBlock(t *testing.T) {
378+
t.Parallel()
379+
364380
kr, err := keystore.NewEd25519Keyring()
365381
require.NoError(t, err)
366382
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -397,6 +413,8 @@ func TestGetPossibleSelectedBlocks_OneBlock(t *testing.T) {
397413
}
398414

399415
func TestGetPossibleSelectedBlocks_EqualVotes_SameAncestor(t *testing.T) {
416+
t.Parallel()
417+
400418
kr, err := keystore.NewEd25519Keyring()
401419
require.NoError(t, err)
402420
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -448,6 +466,8 @@ func TestGetPossibleSelectedBlocks_EqualVotes_SameAncestor(t *testing.T) {
448466
}
449467

450468
func TestGetPossibleSelectedBlocks_EqualVotes_VaryingAncestor(t *testing.T) {
469+
t.Parallel()
470+
451471
kr, err := keystore.NewEd25519Keyring()
452472
require.NoError(t, err)
453473
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -500,6 +520,8 @@ func TestGetPossibleSelectedBlocks_EqualVotes_VaryingAncestor(t *testing.T) {
500520
}
501521

502522
func TestGetPossibleSelectedBlocks_OneThirdEquivocating(t *testing.T) {
523+
t.Parallel()
524+
503525
kr, err := keystore.NewEd25519Keyring()
504526
require.NoError(t, err)
505527
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -545,6 +567,8 @@ func TestGetPossibleSelectedBlocks_OneThirdEquivocating(t *testing.T) {
545567
}
546568

547569
func TestGetPossibleSelectedBlocks_MoreThanOneThirdEquivocating(t *testing.T) {
570+
t.Parallel()
571+
548572
kr, err := keystore.NewEd25519Keyring()
549573
require.NoError(t, err)
550574
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -596,6 +620,8 @@ func TestGetPossibleSelectedBlocks_MoreThanOneThirdEquivocating(t *testing.T) {
596620
}
597621

598622
func TestGetPreVotedBlock_OneBlock(t *testing.T) {
623+
t.Parallel()
624+
599625
kr, err := keystore.NewEd25519Keyring()
600626
require.NoError(t, err)
601627
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -631,6 +657,8 @@ func TestGetPreVotedBlock_OneBlock(t *testing.T) {
631657
}
632658

633659
func TestGetPreVotedBlock_MultipleCandidates(t *testing.T) {
660+
t.Parallel()
661+
634662
kr, err := keystore.NewEd25519Keyring()
635663
require.NoError(t, err)
636664
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -681,6 +709,8 @@ func TestGetPreVotedBlock_MultipleCandidates(t *testing.T) {
681709
}
682710

683711
func TestGetPreVotedBlock_EvenMoreCandidates(t *testing.T) {
712+
t.Parallel()
713+
684714
kr, err := keystore.NewEd25519Keyring()
685715
require.NoError(t, err)
686716
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -753,6 +783,8 @@ func TestGetPreVotedBlock_EvenMoreCandidates(t *testing.T) {
753783
}
754784

755785
func TestFindParentWithNumber(t *testing.T) {
786+
t.Parallel()
787+
756788
kr, err := keystore.NewEd25519Keyring()
757789
require.NoError(t, err)
758790
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -818,6 +850,8 @@ func TestGetBestFinalCandidate_OneBlock(t *testing.T) {
818850
}
819851

820852
func TestGetBestFinalCandidate_PrecommitAncestor(t *testing.T) {
853+
t.Parallel()
854+
821855
kr, err := keystore.NewEd25519Keyring()
822856
require.NoError(t, err)
823857
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -864,6 +898,8 @@ func TestGetBestFinalCandidate_PrecommitAncestor(t *testing.T) {
864898
}
865899

866900
func TestGetBestFinalCandidate_NoPrecommit(t *testing.T) {
901+
t.Parallel()
902+
867903
kr, err := keystore.NewEd25519Keyring()
868904
require.NoError(t, err)
869905
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -904,6 +940,8 @@ func TestGetBestFinalCandidate_NoPrecommit(t *testing.T) {
904940
}
905941

906942
func TestGetBestFinalCandidate_PrecommitOnAnotherChain(t *testing.T) {
943+
t.Parallel()
944+
907945
kr, err := keystore.NewEd25519Keyring()
908946
require.NoError(t, err)
909947
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -950,6 +988,8 @@ func TestGetBestFinalCandidate_PrecommitOnAnotherChain(t *testing.T) {
950988
}
951989

952990
func TestDeterminePreVote_NoPrimaryPreVote(t *testing.T) {
991+
t.Parallel()
992+
953993
kr, err := keystore.NewEd25519Keyring()
954994
require.NoError(t, err)
955995
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -966,6 +1006,8 @@ func TestDeterminePreVote_NoPrimaryPreVote(t *testing.T) {
9661006
}
9671007

9681008
func TestDeterminePreVote_WithPrimaryPreVote(t *testing.T) {
1009+
t.Parallel()
1010+
9691011
kr, err := keystore.NewEd25519Keyring()
9701012
require.NoError(t, err)
9711013
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -991,6 +1033,8 @@ func TestDeterminePreVote_WithPrimaryPreVote(t *testing.T) {
9911033
}
9921034

9931035
func TestDeterminePreVote_WithInvalidPrimaryPreVote(t *testing.T) {
1036+
t.Parallel()
1037+
9941038
kr, err := keystore.NewEd25519Keyring()
9951039
require.NoError(t, err)
9961040
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -1017,6 +1061,8 @@ func TestDeterminePreVote_WithInvalidPrimaryPreVote(t *testing.T) {
10171061
}
10181062

10191063
func TestGetGrandpaGHOST_CommonAncestor(t *testing.T) {
1064+
t.Parallel()
1065+
10201066
kr, err := keystore.NewEd25519Keyring()
10211067
require.NoError(t, err)
10221068
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -1055,6 +1101,8 @@ func TestGetGrandpaGHOST_CommonAncestor(t *testing.T) {
10551101
}
10561102

10571103
func TestGetGrandpaGHOST_MultipleCandidates(t *testing.T) {
1104+
t.Parallel()
1105+
10581106
kr, err := keystore.NewEd25519Keyring()
10591107
require.NoError(t, err)
10601108
aliceKeyPair := kr.Alice().(*ed25519.Keypair)
@@ -1108,6 +1156,8 @@ func TestGetGrandpaGHOST_MultipleCandidates(t *testing.T) {
11081156
}
11091157

11101158
func TestGrandpaServiceCreateJustification_ShouldCountEquivocatoryVotes(t *testing.T) {
1159+
t.Parallel()
1160+
11111161
kr, err := keystore.NewEd25519Keyring()
11121162
require.NoError(t, err)
11131163
aliceKeyPair := kr.Alice().(*ed25519.Keypair)

0 commit comments

Comments
 (0)