Skip to content

Commit 6de382a

Browse files
committed
parallelize tests
1 parent 96a0627 commit 6de382a

File tree

5 files changed

+52
-0
lines changed

5 files changed

+52
-0
lines changed

fvm/accounts_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ func newAccountKey(
360360

361361
func TestCreateAccount(t *testing.T) {
362362

363+
t.Parallel()
364+
363365
options := []fvm.Option{
364366
fvm.WithAuthorizationChecksEnabled(false),
365367
fvm.WithSequenceNumberCheckAndIncrementEnabled(false),
@@ -469,6 +471,8 @@ func TestCreateAccount(t *testing.T) {
469471

470472
func TestCreateAccount_WithRestrictedAccountCreation(t *testing.T) {
471473

474+
t.Parallel()
475+
472476
options := []fvm.Option{
473477
fvm.WithAuthorizationChecksEnabled(false),
474478
fvm.WithSequenceNumberCheckAndIncrementEnabled(false),
@@ -614,6 +618,8 @@ func TestCreateAccount_WithRestrictedAccountCreation(t *testing.T) {
614618

615619
func TestAddAccountKey(t *testing.T) {
616620

621+
t.Parallel()
622+
617623
options := []fvm.Option{
618624
fvm.WithAuthorizationChecksEnabled(false),
619625
fvm.WithSequenceNumberCheckAndIncrementEnabled(false),
@@ -932,6 +938,8 @@ func TestAddAccountKey(t *testing.T) {
932938

933939
func TestRemoveAccountKey(t *testing.T) {
934940

941+
t.Parallel()
942+
935943
options := []fvm.Option{
936944
fvm.WithAuthorizationChecksEnabled(false),
937945
fvm.WithSequenceNumberCheckAndIncrementEnabled(false),
@@ -1211,6 +1219,8 @@ func TestRemoveAccountKey(t *testing.T) {
12111219

12121220
func TestGetAccountKey(t *testing.T) {
12131221

1222+
t.Parallel()
1223+
12141224
options := []fvm.Option{
12151225
fvm.WithAuthorizationChecksEnabled(false),
12161226
fvm.WithSequenceNumberCheckAndIncrementEnabled(false),
@@ -1483,6 +1493,9 @@ func byteSliceToCadenceArrayLiteral(bytes []byte) string {
14831493
}
14841494

14851495
func TestAccountBalanceFields(t *testing.T) {
1496+
1497+
t.Parallel()
1498+
14861499
t.Run("Get balance works",
14871500
newVMTest().withContextOptions(
14881501
fvm.WithAuthorizationChecksEnabled(false),
@@ -1725,6 +1738,9 @@ func TestAccountBalanceFields(t *testing.T) {
17251738
}
17261739

17271740
func TestGetStorageCapacity(t *testing.T) {
1741+
1742+
t.Parallel()
1743+
17281744
t.Run("Get storage capacity",
17291745
newVMTest().withContextOptions(
17301746
fvm.WithAuthorizationChecksEnabled(false),

fvm/environment/programs_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ func getTestContract(
147147
}
148148

149149
func Test_Programs(t *testing.T) {
150+
t.Parallel()
151+
150152
vm := fvm.NewVirtualMachine()
151153
derivedBlockData := derived.NewEmptyDerivedBlockData(0)
152154

fvm/fvm_blockcontext_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,6 +1751,8 @@ func TestBlockContext_GetAccount(t *testing.T) {
17511751
}
17521752

17531753
func TestBlockContext_Random(t *testing.T) {
1754+
t.Parallel()
1755+
17541756
chain, vm := createChainAndVm(flow.Mainnet)
17551757
header := &flow.Header{HeaderBody: flow.HeaderBody{Height: 42}}
17561758
source := testutil.EntropyProviderFixture(nil)
@@ -1906,6 +1908,8 @@ func TestBlockContext_ExecuteTransaction_CreateAccount_WithMonotonicAddresses(t
19061908
}
19071909

19081910
func TestBlockContext_ExecuteTransaction_FailingTransactions(t *testing.T) {
1911+
t.Parallel()
1912+
19091913
getBalance := func(
19101914
vm fvm.VM,
19111915
chain flow.Chain,

fvm/fvm_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,8 @@ func TestWithServiceAccount(t *testing.T) {
474474
}
475475

476476
func TestEventLimits(t *testing.T) {
477+
t.Parallel()
478+
477479
chain, vm := createChainAndVm(flow.Mainnet)
478480

479481
ctx := fvm.NewContext(
@@ -579,6 +581,7 @@ func TestEventLimits(t *testing.T) {
579581
// TestHappyPathSigning checks that a signing a transaction with `Sign` doesn't produce an error.
580582
// Transaction verification tests are in `TestVerifySignatureFromTransaction`.
581583
func TestHappyPathTransactionSigning(t *testing.T) {
584+
t.Parallel()
582585

583586
newVMTest().run(
584587
func(t *testing.T, vm fvm.VM, chain flow.Chain, ctx fvm.Context, snapshotTree snapshot.SnapshotTree) {
@@ -620,6 +623,8 @@ func TestHappyPathTransactionSigning(t *testing.T) {
620623
}
621624

622625
func TestTransactionFeeDeduction(t *testing.T) {
626+
t.Parallel()
627+
623628
getBalance := func(vm fvm.VM, chain flow.Chain, ctx fvm.Context, snapshotTree snapshot.SnapshotTree, address flow.Address) uint64 {
624629
sc := systemcontracts.SystemContractsForChain(chain.ChainID())
625630
code := []byte(fmt.Sprintf(
@@ -1098,6 +1103,7 @@ func TestTransactionFeeDeduction(t *testing.T) {
10981103
}
10991104

11001105
func TestSettingExecutionWeights(t *testing.T) {
1106+
t.Parallel()
11011107

11021108
// change the chain so that the metering settings are read from the service account
11031109
chain := flow.Emulator.Chain()
@@ -1837,6 +1843,8 @@ func TestEnforcingComputationLimit(t *testing.T) {
18371843
}
18381844

18391845
func TestStorageCapacity(t *testing.T) {
1846+
t.Parallel()
1847+
18401848
t.Run("Storage capacity updates on FLOW transfer", newVMTest().
18411849
withContextOptions(
18421850
fvm.WithAuthorizationChecksEnabled(false),
@@ -2328,6 +2336,9 @@ func TestScriptExecutionLimit(t *testing.T) {
23282336
}
23292337

23302338
func TestInteractionLimit(t *testing.T) {
2339+
2340+
t.Parallel()
2341+
23312342
type testCase struct {
23322343
name string
23332344
interactionLimit uint64
@@ -2497,6 +2508,7 @@ func TestInteractionLimit(t *testing.T) {
24972508
}
24982509

24992510
func TestAttachments(t *testing.T) {
2511+
t.Parallel()
25002512

25012513
newVMTest().
25022514
withBootstrapProcedureOptions().
@@ -2531,6 +2543,8 @@ func TestAttachments(t *testing.T) {
25312543
}
25322544

25332545
func TestCapabilityControllers(t *testing.T) {
2546+
t.Parallel()
2547+
25342548
test := func(t *testing.T) {
25352549
newVMTest().
25362550
withBootstrapProcedureOptions().
@@ -2800,6 +2814,8 @@ func TestStorageIterationWithBrokenValues(t *testing.T) {
28002814
}
28012815

28022816
func TestEntropyCallOnlyOkIfAllowed(t *testing.T) {
2817+
t.Parallel()
2818+
28032819
source := testutil.EntropyProviderFixture(nil)
28042820

28052821
test := func(t *testing.T, allowed bool) {
@@ -2859,6 +2875,8 @@ func TestEntropyCallOnlyOkIfAllowed(t *testing.T) {
28592875
}
28602876

28612877
func TestEntropyCallExpectsNoParameters(t *testing.T) {
2878+
t.Parallel()
2879+
28622880
source := testutil.EntropyProviderFixture(nil)
28632881
newVMTest().
28642882
withBootstrapProcedureOptions().
@@ -2902,6 +2920,7 @@ func TestEntropyCallExpectsNoParameters(t *testing.T) {
29022920
}
29032921

29042922
func TestTransientNetworkCoreContractAddresses(t *testing.T) {
2923+
t.Parallel()
29052924

29062925
// This test ensures that the transient networks have the correct core contract addresses.
29072926
newVMTest().
@@ -2927,6 +2946,8 @@ func TestTransientNetworkCoreContractAddresses(t *testing.T) {
29272946
}
29282947

29292948
func TestFlowCallbackScheduler(t *testing.T) {
2949+
t.Parallel()
2950+
29302951
ctxOpts := []fvm.Option{
29312952
fvm.WithScheduleCallbacksEnabled(true),
29322953
}
@@ -2975,6 +2996,8 @@ func TestFlowCallbackScheduler(t *testing.T) {
29752996
}
29762997

29772998
func TestEVM(t *testing.T) {
2999+
t.Parallel()
3000+
29783001
blocks := new(envMock.Blocks)
29793002
block1 := unittest.BlockFixture()
29803003
blocks.On("ByHeightFrom",
@@ -3244,6 +3267,8 @@ func TestEVM(t *testing.T) {
32443267
}
32453268

32463269
func TestVMBridge(t *testing.T) {
3270+
t.Parallel()
3271+
32473272
blocks := new(envMock.Blocks)
32483273
block1 := unittest.BlockFixture()
32493274
blocks.On("ByHeightFrom",
@@ -3812,6 +3837,7 @@ func TestVMBridge(t *testing.T) {
38123837
}
38133838

38143839
func TestAccountCapabilitiesGetEntitledRejection(t *testing.T) {
3840+
t.Parallel()
38153841

38163842
// Note: This cannot be tested anymore using a transaction,
38173843
// because publish method also aborts when trying to publish an entitled capability.
@@ -3874,6 +3900,7 @@ func TestAccountCapabilitiesGetEntitledRejection(t *testing.T) {
38743900
}
38753901

38763902
func TestAccountCapabilitiesPublishEntitledRejection(t *testing.T) {
3903+
t.Parallel()
38773904

38783905
t.Run("entitled capability", newVMTest().
38793906
run(func(
@@ -4131,6 +4158,7 @@ func TestCrypto(t *testing.T) {
41314158
}
41324159

41334160
func Test_BlockHashListShouldWriteOnPush(t *testing.T) {
4161+
t.Parallel()
41344162

41354163
chain := flow.Emulator.Chain()
41364164
sc := systemcontracts.SystemContractsForChain(chain.ChainID())

fvm/transactionVerifier_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import (
1717
)
1818

1919
func TestTransactionVerification(t *testing.T) {
20+
t.Parallel()
21+
2022
txnState := testutils.NewSimpleTransaction(nil)
2123
accounts := environment.NewAccounts(txnState)
2224

0 commit comments

Comments
 (0)