internal: run tests in parallel (#30381)
Continuation of https://github.com/ethereum/go-ethereum/pull/28546
This commit is contained in:
parent
ae707445f5
commit
4c4f21293e
|
@ -26,6 +26,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEncode(t *testing.T) {
|
func TestEncode(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
entries []Entry
|
entries []Entry
|
||||||
want string
|
want string
|
||||||
|
@ -53,6 +55,7 @@ func TestEncode(t *testing.T) {
|
||||||
tt := test
|
tt := test
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
b = bytes.NewBuffer(nil)
|
b = bytes.NewBuffer(nil)
|
||||||
w = NewWriter(b)
|
w = NewWriter(b)
|
||||||
|
@ -83,6 +86,8 @@ func TestEncode(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDecode(t *testing.T) {
|
func TestDecode(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
for i, tt := range []struct {
|
for i, tt := range []struct {
|
||||||
have string
|
have string
|
||||||
err error
|
err error
|
||||||
|
|
|
@ -34,6 +34,8 @@ type testchain struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEra1Builder(t *testing.T) {
|
func TestEra1Builder(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
// Get temp directory.
|
// Get temp directory.
|
||||||
f, err := os.CreateTemp("", "era1-test")
|
f, err := os.CreateTemp("", "era1-test")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -125,6 +127,8 @@ func TestEra1Builder(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEraFilename(t *testing.T) {
|
func TestEraFilename(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
for i, tt := range []struct {
|
for i, tt := range []struct {
|
||||||
network string
|
network string
|
||||||
epoch int
|
epoch int
|
||||||
|
|
|
@ -61,7 +61,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func testTransactionMarshal(t *testing.T, tests []txData, config *params.ChainConfig) {
|
func testTransactionMarshal(t *testing.T, tests []txData, config *params.ChainConfig) {
|
||||||
t.Parallel()
|
|
||||||
var (
|
var (
|
||||||
signer = types.LatestSigner(config)
|
signer = types.LatestSigner(config)
|
||||||
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||||
|
@ -98,6 +97,8 @@ func testTransactionMarshal(t *testing.T, tests []txData, config *params.ChainCo
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTransaction_RoundTripRpcJSON(t *testing.T) {
|
func TestTransaction_RoundTripRpcJSON(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
config = params.AllEthashProtocolChanges
|
config = params.AllEthashProtocolChanges
|
||||||
tests = allTransactionTypes(common.Address{0xde, 0xad}, config)
|
tests = allTransactionTypes(common.Address{0xde, 0xad}, config)
|
||||||
|
@ -106,6 +107,8 @@ func TestTransaction_RoundTripRpcJSON(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTransactionBlobTx(t *testing.T) {
|
func TestTransactionBlobTx(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
config := *params.TestChainConfig
|
config := *params.TestChainConfig
|
||||||
config.ShanghaiTime = new(uint64)
|
config.ShanghaiTime = new(uint64)
|
||||||
config.CancunTime = new(uint64)
|
config.CancunTime = new(uint64)
|
||||||
|
@ -2460,6 +2463,8 @@ func TestFillBlobTransaction(t *testing.T) {
|
||||||
}
|
}
|
||||||
for _, tc := range suite {
|
for _, tc := range suite {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
res, err := api.FillTransaction(context.Background(), tc.args)
|
res, err := api.FillTransaction(context.Background(), tc.args)
|
||||||
if len(tc.err) > 0 {
|
if len(tc.err) > 0 {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
|
@ -42,6 +42,8 @@ import (
|
||||||
|
|
||||||
// TestSetFeeDefaults tests the logic for filling in default fee values works as expected.
|
// TestSetFeeDefaults tests the logic for filling in default fee values works as expected.
|
||||||
func TestSetFeeDefaults(t *testing.T) {
|
func TestSetFeeDefaults(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
type test struct {
|
type test struct {
|
||||||
name string
|
name string
|
||||||
fork string // options: legacy, london, cancun
|
fork string // options: legacy, london, cancun
|
||||||
|
|
|
@ -24,6 +24,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPathExpansion(t *testing.T) {
|
func TestPathExpansion(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
user, _ := user.Current()
|
user, _ := user.Current()
|
||||||
var tests map[string]string
|
var tests map[string]string
|
||||||
|
|
||||||
|
@ -53,9 +55,13 @@ func TestPathExpansion(t *testing.T) {
|
||||||
|
|
||||||
os.Setenv(`DDDXXX`, `/tmp`)
|
os.Setenv(`DDDXXX`, `/tmp`)
|
||||||
for test, expected := range tests {
|
for test, expected := range tests {
|
||||||
got := expandPath(test)
|
t.Run(test, func(t *testing.T) {
|
||||||
if got != expected {
|
t.Parallel()
|
||||||
t.Errorf(`test %s, got %s, expected %s\n`, test, got, expected)
|
|
||||||
}
|
got := expandPath(test)
|
||||||
|
if got != expected {
|
||||||
|
t.Errorf(`test %s, got %s, expected %s\n`, test, got, expected)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ import (
|
||||||
|
|
||||||
// Tests that the account management snippets work correctly.
|
// Tests that the account management snippets work correctly.
|
||||||
func TestAccountManagement(t *testing.T) {
|
func TestAccountManagement(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
// Create a temporary folder to work with
|
// Create a temporary folder to work with
|
||||||
workdir := t.TempDir()
|
workdir := t.TempDir()
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCompleteKeywords(t *testing.T) {
|
func TestCompleteKeywords(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
re := New("", os.Stdout)
|
re := New("", os.Stdout)
|
||||||
re.Run(`
|
re.Run(`
|
||||||
function theClass() {
|
function theClass() {
|
||||||
|
@ -85,9 +87,13 @@ func TestCompleteKeywords(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
cs := re.CompleteKeywords(test.input)
|
t.Run(test.input, func(t *testing.T) {
|
||||||
if !reflect.DeepEqual(cs, test.want) {
|
t.Parallel()
|
||||||
t.Errorf("wrong completions for %q\ngot %v\nwant %v", test.input, cs, test.want)
|
|
||||||
}
|
cs := re.CompleteKeywords(test.input)
|
||||||
|
if !reflect.DeepEqual(cs, test.want) {
|
||||||
|
t.Errorf("wrong completions for %q\ngot %v\nwant %v", test.input, cs, test.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,8 @@ func newWithTestJS(t *testing.T, testjs string) *JSRE {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExec(t *testing.T) {
|
func TestExec(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
jsre := newWithTestJS(t, `msg = "testMsg"`)
|
jsre := newWithTestJS(t, `msg = "testMsg"`)
|
||||||
|
|
||||||
err := jsre.Exec("test.js")
|
err := jsre.Exec("test.js")
|
||||||
|
@ -73,6 +75,8 @@ func TestExec(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNatto(t *testing.T) {
|
func TestNatto(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
jsre := newWithTestJS(t, `setTimeout(function(){msg = "testMsg"}, 1);`)
|
jsre := newWithTestJS(t, `setTimeout(function(){msg = "testMsg"}, 1);`)
|
||||||
|
|
||||||
err := jsre.Exec("test.js")
|
err := jsre.Exec("test.js")
|
||||||
|
@ -96,6 +100,8 @@ func TestNatto(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBind(t *testing.T) {
|
func TestBind(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
jsre := New("", os.Stdout)
|
jsre := New("", os.Stdout)
|
||||||
defer jsre.Stop(false)
|
defer jsre.Stop(false)
|
||||||
|
|
||||||
|
@ -108,6 +114,8 @@ func TestBind(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadScript(t *testing.T) {
|
func TestLoadScript(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
jsre := newWithTestJS(t, `msg = "testMsg"`)
|
jsre := newWithTestJS(t, `msg = "testMsg"`)
|
||||||
|
|
||||||
_, err := jsre.Run(`loadScript("test.js")`)
|
_, err := jsre.Run(`loadScript("test.js")`)
|
||||||
|
|
|
@ -24,6 +24,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTest(t *testing.T) {
|
func TestTest(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
tests := []Test{
|
tests := []Test{
|
||||||
{
|
{
|
||||||
Name: "successful test",
|
Name: "successful test",
|
||||||
|
@ -90,6 +92,8 @@ var outputTests = []Test{
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOutput(t *testing.T) {
|
func TestOutput(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
RunTests(outputTests, &buf)
|
RunTests(outputTests, &buf)
|
||||||
|
|
||||||
|
@ -116,6 +120,8 @@ $`[1:])
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOutputTAP(t *testing.T) {
|
func TestOutputTAP(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
RunTAP(outputTests, &buf)
|
RunTAP(outputTests, &buf)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue