Skip to content

Commit ae03439

Browse files
committed
parallelize tests
1 parent 6de382a commit ae03439

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

engine/execution/block_result_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ func makeBlockExecutionResultFixture(serviceEventsPerChunk []int) *BlockExecutio
2626

2727
// Tests that ServiceEventCountForChunk method works as expected under various circumstances:
2828
func TestBlockExecutionResult_ServiceEventCountForChunk(t *testing.T) {
29+
t.Parallel()
30+
2931
t.Run("no service events", func(t *testing.T) {
3032
nChunks := rand.Intn(10) + 1 // always contains at least system chunk
3133
blockResult := makeBlockExecutionResultFixture(make([]int, nChunks))

engine/execution/computation/execution_verification_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ var chain = flow.Emulator.Chain()
5656
// This is not relevant to the test, as only the non-system transactions are tested.
5757

5858
func Test_ExecutionMatchesVerification(t *testing.T) {
59+
60+
t.Parallel()
61+
5962
t.Run("empty block", func(t *testing.T) {
6063
executeBlockAndVerify(t,
6164
[][]*flow.TransactionBody{},
@@ -339,6 +342,7 @@ func Test_ExecutionMatchesVerification(t *testing.T) {
339342
}
340343

341344
func TestTransactionFeeDeduction(t *testing.T) {
345+
t.Parallel()
342346

343347
type testCase struct {
344348
name string

engine/execution/computation/manager_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ import (
5151
var scriptLogThreshold = 1 * time.Second
5252

5353
func TestComputeBlockWithStorage(t *testing.T) {
54+
t.Parallel()
55+
5456
chain := flow.Mainnet.Chain()
5557

5658
vm := fvm.NewVirtualMachine()
@@ -180,6 +182,7 @@ func TestComputeBlockWithStorage(t *testing.T) {
180182
}
181183

182184
func TestComputeBlock_Uploader(t *testing.T) {
185+
t.Parallel()
183186

184187
noopCollector := &metrics.NoopCollector{}
185188

@@ -230,6 +233,7 @@ func TestComputeBlock_Uploader(t *testing.T) {
230233
}
231234

232235
func TestExecuteScript(t *testing.T) {
236+
t.Parallel()
233237

234238
logger := zerolog.Nop()
235239

@@ -296,6 +300,7 @@ func TestExecuteScript(t *testing.T) {
296300
// Balance script used to swallow errors, which meant that even if the view was empty, a script that did nothing but get
297301
// the balance of an account would succeed and return 0.
298302
func TestExecuteScript_BalanceScriptFailsIfViewIsEmpty(t *testing.T) {
303+
t.Parallel()
299304

300305
logger := zerolog.Nop()
301306

@@ -361,6 +366,7 @@ func TestExecuteScript_BalanceScriptFailsIfViewIsEmpty(t *testing.T) {
361366
}
362367

363368
func TestExecuteScripPanicsAreHandled(t *testing.T) {
369+
t.Parallel()
364370

365371
ctx := fvm.NewContext()
366372

@@ -411,6 +417,7 @@ func TestExecuteScripPanicsAreHandled(t *testing.T) {
411417
}
412418

413419
func TestExecuteScript_LongScriptsAreLogged(t *testing.T) {
420+
t.Parallel()
414421

415422
ctx := fvm.NewContext()
416423

@@ -464,6 +471,7 @@ func TestExecuteScript_LongScriptsAreLogged(t *testing.T) {
464471
}
465472

466473
func TestExecuteScript_ShortScriptsAreNotLogged(t *testing.T) {
474+
t.Parallel()
467475

468476
ctx := fvm.NewContext()
469477

@@ -647,6 +655,7 @@ func (f *FakeBlockComputer) ExecuteBlock(
647655
}
648656

649657
func TestExecuteScriptTimeout(t *testing.T) {
658+
t.Parallel()
650659

651660
timeout := 1 * time.Millisecond
652661
manager, err := New(
@@ -694,6 +703,7 @@ func TestExecuteScriptTimeout(t *testing.T) {
694703
}
695704

696705
func TestExecuteScriptCancelled(t *testing.T) {
706+
t.Parallel()
697707

698708
timeout := 30 * time.Second
699709
manager, err := New(
@@ -750,6 +760,7 @@ func TestExecuteScriptCancelled(t *testing.T) {
750760
}
751761

752762
func Test_EventEncodingFailsOnlyTxAndCarriesOn(t *testing.T) {
763+
t.Parallel()
753764

754765
chain := flow.Mainnet.Chain()
755766
vm := fvm.NewVirtualMachine()
@@ -908,6 +919,7 @@ func (e *testingEventEncoder) Encode(event cadence.Event) ([]byte, error) {
908919
}
909920

910921
func TestScriptStorageMutationsDiscarded(t *testing.T) {
922+
t.Parallel()
911923

912924
timeout := 10 * time.Second
913925
chain := flow.Mainnet.Chain()

engine/execution/computation/programs_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const (
4040
)
4141

4242
func TestPrograms_TestContractUpdates(t *testing.T) {
43+
t.Parallel()
44+
4345
chain := flow.Mainnet.Chain()
4446
vm := fvm.NewVirtualMachine()
4547
execCtx := fvm.NewContext(fvm.WithChain(chain))
@@ -215,6 +217,8 @@ func (b blockProvider) ByHeightFrom(height uint64, _ *flow.Header) (*flow.Header
215217
// -> Block121 (emit event - version should be 2)
216218
// -> Block1211 (emit event - version should be 2)
217219
func TestPrograms_TestBlockForks(t *testing.T) {
220+
t.Parallel()
221+
218222
block := unittest.BlockFixture()
219223
chain := flow.Emulator.Chain()
220224
vm := fvm.NewVirtualMachine()

engine/execution/execution_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ func sendBlock(exeNode *testmock.ExecutionNode, from flow.Identifier, proposal *
3838
// create another child block which will trigger the parent
3939
// block to be incorporated and be passed to the ingestion engine
4040
func TestExecutionFlow(t *testing.T) {
41+
t.Parallel()
42+
4143
hub := stub.NewNetworkHub()
4244

4345
chainID := flow.Testnet
@@ -383,6 +385,8 @@ func makeSuccessBlock(t *testing.T, conID *flow.Identity, colID *flow.Identity,
383385
// Test a successful tx should change the statecommitment,
384386
// but a failed Tx should not change the statecommitment.
385387
func TestFailedTxWillNotChangeStateCommitment(t *testing.T) {
388+
t.Parallel()
389+
386390
hub := stub.NewNetworkHub()
387391

388392
chainID := flow.Emulator
@@ -547,6 +551,8 @@ func mockCollectionEngineToReturnCollections(t *testing.T, collectionNode *testm
547551

548552
// Test the receipt will be sent to multiple verification nodes
549553
func TestBroadcastToMultipleVerificationNodes(t *testing.T) {
554+
t.Parallel()
555+
550556
hub := stub.NewNetworkHub()
551557

552558
chainID := flow.Emulator

0 commit comments

Comments
 (0)