Skip to content

Commit 29f6a6e

Browse files
estensenzfy0701
authored andcommitted
internal: run tests in parallel (ethereum#30381)
Continuation of ethereum#28546
1 parent f44830e commit 29f6a6e

File tree

9 files changed

+53
-9
lines changed

9 files changed

+53
-9
lines changed

internal/era/e2store/e2store_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
)
2727

2828
func TestEncode(t *testing.T) {
29+
t.Parallel()
30+
2931
for _, test := range []struct {
3032
entries []Entry
3133
want string
@@ -53,6 +55,7 @@ func TestEncode(t *testing.T) {
5355
tt := test
5456
t.Run(tt.name, func(t *testing.T) {
5557
t.Parallel()
58+
5659
var (
5760
b = bytes.NewBuffer(nil)
5861
w = NewWriter(b)
@@ -83,6 +86,8 @@ func TestEncode(t *testing.T) {
8386
}
8487

8588
func TestDecode(t *testing.T) {
89+
t.Parallel()
90+
8691
for i, tt := range []struct {
8792
have string
8893
err error

internal/era/era_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ type testchain struct {
3434
}
3535

3636
func TestEra1Builder(t *testing.T) {
37+
t.Parallel()
38+
3739
// Get temp directory.
3840
f, err := os.CreateTemp("", "era1-test")
3941
if err != nil {
@@ -125,6 +127,8 @@ func TestEra1Builder(t *testing.T) {
125127
}
126128

127129
func TestEraFilename(t *testing.T) {
130+
t.Parallel()
131+
128132
for i, tt := range []struct {
129133
network string
130134
epoch int

internal/ethapi/api_test.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ import (
6161
)
6262

6363
func testTransactionMarshal(t *testing.T, tests []txData, config *params.ChainConfig) {
64-
t.Parallel()
6564
var (
6665
signer = types.LatestSigner(config)
6766
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
@@ -98,6 +97,8 @@ func testTransactionMarshal(t *testing.T, tests []txData, config *params.ChainCo
9897
}
9998

10099
func TestTransaction_RoundTripRpcJSON(t *testing.T) {
100+
t.Parallel()
101+
101102
var (
102103
config = params.AllEthashProtocolChanges
103104
tests = allTransactionTypes(common.Address{0xde, 0xad}, config)
@@ -106,6 +107,8 @@ func TestTransaction_RoundTripRpcJSON(t *testing.T) {
106107
}
107108

108109
func TestTransactionBlobTx(t *testing.T) {
110+
t.Parallel()
111+
109112
config := *params.TestChainConfig
110113
config.ShanghaiTime = new(uint64)
111114
config.CancunTime = new(uint64)
@@ -2460,6 +2463,8 @@ func TestFillBlobTransaction(t *testing.T) {
24602463
}
24612464
for _, tc := range suite {
24622465
t.Run(tc.name, func(t *testing.T) {
2466+
t.Parallel()
2467+
24632468
res, err := api.FillTransaction(context.Background(), tc.args)
24642469
if len(tc.err) > 0 {
24652470
if err == nil {

internal/ethapi/transaction_args_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ import (
4242

4343
// TestSetFeeDefaults tests the logic for filling in default fee values works as expected.
4444
func TestSetFeeDefaults(t *testing.T) {
45+
t.Parallel()
46+
4547
type test struct {
4648
name string
4749
fork string // options: legacy, london, cancun

internal/flags/flags_test.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import (
2424
)
2525

2626
func TestPathExpansion(t *testing.T) {
27+
t.Parallel()
28+
2729
user, _ := user.Current()
2830
var tests map[string]string
2931

@@ -53,9 +55,13 @@ func TestPathExpansion(t *testing.T) {
5355

5456
os.Setenv(`DDDXXX`, `/tmp`)
5557
for test, expected := range tests {
56-
got := expandPath(test)
57-
if got != expected {
58-
t.Errorf(`test %s, got %s, expected %s\n`, test, got, expected)
59-
}
58+
t.Run(test, func(t *testing.T) {
59+
t.Parallel()
60+
61+
got := expandPath(test)
62+
if got != expected {
63+
t.Errorf(`test %s, got %s, expected %s\n`, test, got, expected)
64+
}
65+
})
6066
}
6167
}

internal/guide/guide_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ import (
3535

3636
// Tests that the account management snippets work correctly.
3737
func TestAccountManagement(t *testing.T) {
38+
t.Parallel()
39+
3840
// Create a temporary folder to work with
3941
workdir := t.TempDir()
4042

internal/jsre/completion_test.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
)
2424

2525
func TestCompleteKeywords(t *testing.T) {
26+
t.Parallel()
27+
2628
re := New("", os.Stdout)
2729
re.Run(`
2830
function theClass() {
@@ -85,9 +87,13 @@ func TestCompleteKeywords(t *testing.T) {
8587
},
8688
}
8789
for _, test := range tests {
88-
cs := re.CompleteKeywords(test.input)
89-
if !reflect.DeepEqual(cs, test.want) {
90-
t.Errorf("wrong completions for %q\ngot %v\nwant %v", test.input, cs, test.want)
91-
}
90+
t.Run(test.input, func(t *testing.T) {
91+
t.Parallel()
92+
93+
cs := re.CompleteKeywords(test.input)
94+
if !reflect.DeepEqual(cs, test.want) {
95+
t.Errorf("wrong completions for %q\ngot %v\nwant %v", test.input, cs, test.want)
96+
}
97+
})
9298
}
9399
}

internal/jsre/jsre_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ func newWithTestJS(t *testing.T, testjs string) *JSRE {
5151
}
5252

5353
func TestExec(t *testing.T) {
54+
t.Parallel()
55+
5456
jsre := newWithTestJS(t, `msg = "testMsg"`)
5557

5658
err := jsre.Exec("test.js")
@@ -73,6 +75,8 @@ func TestExec(t *testing.T) {
7375
}
7476

7577
func TestNatto(t *testing.T) {
78+
t.Parallel()
79+
7680
jsre := newWithTestJS(t, `setTimeout(function(){msg = "testMsg"}, 1);`)
7781

7882
err := jsre.Exec("test.js")
@@ -96,6 +100,8 @@ func TestNatto(t *testing.T) {
96100
}
97101

98102
func TestBind(t *testing.T) {
103+
t.Parallel()
104+
99105
jsre := New("", os.Stdout)
100106
defer jsre.Stop(false)
101107

@@ -108,6 +114,8 @@ func TestBind(t *testing.T) {
108114
}
109115

110116
func TestLoadScript(t *testing.T) {
117+
t.Parallel()
118+
111119
jsre := newWithTestJS(t, `msg = "testMsg"`)
112120

113121
_, err := jsre.Run(`loadScript("test.js")`)

internal/utesting/utesting_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import (
2424
)
2525

2626
func TestTest(t *testing.T) {
27+
t.Parallel()
28+
2729
tests := []Test{
2830
{
2931
Name: "successful test",
@@ -90,6 +92,8 @@ var outputTests = []Test{
9092
}
9193

9294
func TestOutput(t *testing.T) {
95+
t.Parallel()
96+
9397
var buf bytes.Buffer
9498
RunTests(outputTests, &buf)
9599

@@ -116,6 +120,8 @@ $`[1:])
116120
}
117121

118122
func TestOutputTAP(t *testing.T) {
123+
t.Parallel()
124+
119125
var buf bytes.Buffer
120126
RunTAP(outputTests, &buf)
121127

0 commit comments

Comments
 (0)