Skip to content

Commit

Permalink
Merge pull request #6047 from multiversx/integration-tests-calling-re…
Browse files Browse the repository at this point in the history
…factor

Uniformized the calling methods for integration tests
  • Loading branch information
sstanculeanu authored Mar 20, 2024
2 parents 5c3ca8c + d2b1804 commit b70bd26
Show file tree
Hide file tree
Showing 92 changed files with 1,073 additions and 397 deletions.
9 changes: 3 additions & 6 deletions factory/status/statusComponents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package status_test

import (
"errors"
"runtime"
"testing"

"github.com/multiversx/mx-chain-communication-go/websocket/data"
Expand Down Expand Up @@ -136,7 +135,9 @@ func TestNewStatusComponentsFactory(t *testing.T) {
}

func TestStatusComponentsFactory_Create(t *testing.T) {
// no t.Parallel for these tests as they create real components
if testing.Short() {
t.Skip("this is not a short test")
}

t.Run("NewSoftwareVersionFactory fails should return error", func(t *testing.T) {
args := createMockStatusComponentsFactoryArgs()
Expand Down Expand Up @@ -188,10 +189,6 @@ func TestStatusComponentsFactory_Create(t *testing.T) {
require.Nil(t, sc)
})
t.Run("should work", func(t *testing.T) {
if runtime.GOOS == "darwin" && runtime.GOARCH == "amd64" {
t.Skip("skipping test on darwin amd64")
}

shardCoordinator := mock.NewMultiShardsCoordinatorMock(2)
shardCoordinator.SelfIDCalled = func() uint32 {
return core.MetachainShardId // coverage
Expand Down
12 changes: 5 additions & 7 deletions genesis/process/genesisBlockCreator_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//go:build !race

// TODO reinstate test after Wasm VM pointer fix

package process

import (
Expand Down Expand Up @@ -180,7 +178,7 @@ func createMockArgument(
SCDeployEnableEpoch: unreachableEpoch,
CleanUpInformativeSCRsEnableEpoch: unreachableEpoch,
SCProcessorV2EnableEpoch: unreachableEpoch,
StakeLimitsEnableEpoch: 10,
StakeLimitsEnableEpoch: 10,
},
},
RoundConfig: testscommon.GetDefaultRoundsConfig(),
Expand Down Expand Up @@ -897,9 +895,9 @@ func TestCreateArgsGenesisBlockCreator_ShouldWorkAndCreateEmpty(t *testing.T) {
blocks, err := gbc.CreateGenesisBlocks()
assert.Nil(t, err)
assert.Equal(t, 3, len(blocks))
for _, block := range blocks {
assert.Zero(t, block.GetNonce())
assert.Zero(t, block.GetRound())
assert.Zero(t, block.GetEpoch())
for _, blockInstance := range blocks {
assert.Zero(t, blockInstance.GetNonce())
assert.Zero(t, blockInstance.GetRound())
assert.Zero(t, blockInstance.GetEpoch())
}
}
4 changes: 4 additions & 0 deletions integrationTests/api/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import (
)

func TestTransactionGroup(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

node := integrationTests.NewTestProcessorNodeWithTestWebServer(3, 0, 0)

testTransactionGasCostWithMissingFields(t, node)
Expand Down
4 changes: 4 additions & 0 deletions integrationTests/benchmarks/loadFromTrie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func TestTrieLoadTime(t *testing.T) {
}

func TestTrieLoadTimeForOneLevel(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

numTrieLevels := 1
numTries := 10000
numChildrenPerBranch := 8
Expand Down
4 changes: 4 additions & 0 deletions integrationTests/chainSimulator/staking/simpleStake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import (

// // Internal test scenario #3
func TestChainSimulator_SimpleStake(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

t.Run("staking ph 4 is not active", func(t *testing.T) {
testChainSimulatorSimpleStake(t, 1, "queued")
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
)

func TestDataComponents_Create_Close_ShouldWork(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

time.Sleep(time.Second * 4)

gc := goroutines.NewGoCounter(goroutines.TestsRelevantGoRoutines)
Expand Down
12 changes: 12 additions & 0 deletions integrationTests/frontend/wallet/txInterception_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import (
const mintingValue = "100000000"

func TestInterceptedTxWithoutDataField(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

value := big.NewInt(0)
value.SetString("999", 10)

Expand All @@ -35,6 +39,10 @@ func TestInterceptedTxWithoutDataField(t *testing.T) {
}

func TestInterceptedTxWithDataField(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

value := big.NewInt(0)
value.SetString("999", 10)

Expand All @@ -55,6 +63,10 @@ func TestInterceptedTxWithDataField(t *testing.T) {
}

func TestInterceptedTxWithSigningOverTxHash(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

value := big.NewInt(0)
value.SetString("1000000000000000000", 10)

Expand Down
8 changes: 6 additions & 2 deletions integrationTests/node/getAccount/getAccount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ func createAccountsRepository(accDB state.AccountsAdapter, blockchain chainData.
}

func TestNode_GetAccountAccountDoesNotExistsShouldRetEmpty(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("this is not a short test")
}

trieStorage, _ := integrationTests.CreateTrieStorageManager(testscommon.CreateMemUnit())
accDB, _ := integrationTests.CreateAccountsDB(0, trieStorage)
Expand Down Expand Up @@ -67,7 +69,9 @@ func TestNode_GetAccountAccountDoesNotExistsShouldRetEmpty(t *testing.T) {
}

func TestNode_GetAccountAccountExistsShouldReturn(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("this is not a short test")
}

testNonce := uint64(7)
testBalance := big.NewInt(100)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func createDefaultConfig() p2pConfig.P2PConfig {
}

func TestConnectionsInNetworkShardingWithShardingWithLists(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

p2pCfg := createDefaultConfig()
p2pCfg.Sharding = p2pConfig.ShardingConfig{
TargetPeerCount: 12,
Expand All @@ -54,10 +58,6 @@ func TestConnectionsInNetworkShardingWithShardingWithLists(t *testing.T) {
}

func testConnectionsInNetworkSharding(t *testing.T, p2pConfig p2pConfig.P2PConfig) {
if testing.Short() {
t.Skip("this is not a short test")
}

nodesPerShard := 8
numMetaNodes := 8
numObserversOnShard := 2
Expand Down
3 changes: 1 addition & 2 deletions integrationTests/singleShard/smartContract/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import (
)

func TestDNS_Register(t *testing.T) {
// TODO reinstate test after Wasm VM pointer fix
if testing.Short() {
t.Skip("cannot run with -race -short; requires Wasm VM fix")
t.Skip("this is not a short test")
}

expectedDNSAddress := []byte{0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 180, 108, 178, 102, 195, 67, 184, 127, 204, 159, 104, 123, 190, 33, 224, 91, 255, 244, 118, 95, 24, 217}
Expand Down
8 changes: 6 additions & 2 deletions integrationTests/state/genesisState/genesisState_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ func TestCreationOfTheGenesisState(t *testing.T) {
}

func TestExtensionNodeToBranchEdgeCaseSet1(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("this is not a short test")
}

tr1 := integrationTests.CreateNewDefaultTrie()
tr2 := integrationTests.CreateNewDefaultTrie()
Expand Down Expand Up @@ -105,7 +107,9 @@ func TestExtensionNodeToBranchEdgeCaseSet1(t *testing.T) {
}

func TestExtensionNodeToBranchEdgeCaseSet2(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("this is not a short test")
}

tr1 := integrationTests.CreateNewDefaultTrie()
tr2 := integrationTests.CreateNewDefaultTrie()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ func TestExecTransaction_SelfTransactionShouldWork(t *testing.T) {
}

func TestExecTransaction_SelfTransactionWithRevertShouldWork(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("this is not a short test")
}

trieStorage, _ := integrationTests.CreateTrieStorageManager(integrationTests.CreateMemUnit())
accnts, _ := integrationTests.CreateAccountsDB(0, trieStorage)
Expand Down Expand Up @@ -182,7 +184,6 @@ func TestExecTransaction_MoreTransactionsMoreIterationsWithRevertShouldWork(t *t
if testing.Short() {
t.Skip("this is not a short test")
}
t.Parallel()

trieStorage, _ := integrationTests.CreateTrieStorageManager(integrationTests.CreateMemUnit())
accnts, _ := integrationTests.CreateAccountsDB(0, trieStorage)
Expand Down
8 changes: 8 additions & 0 deletions integrationTests/state/stateTrieSync/stateTrieSync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ func createTestProcessorNodeAndTrieStorage(
}

func TestNode_RequestInterceptTrieNodesWithMessenger(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

t.Run("test with double lists version", func(t *testing.T) {
testNodeRequestInterceptTrieNodesWithMessenger(t, 2)
})
Expand Down Expand Up @@ -180,6 +184,10 @@ func printStatistics(ctx context.Context, stats common.SizeSyncStatisticsHandler
}

func TestNode_RequestInterceptTrieNodesWithMessengerNotSyncingShouldErr(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

t.Run("test with double lists version", func(t *testing.T) {
testNodeRequestInterceptTrieNodesWithMessengerNotSyncingShouldErr(t, 2)
})
Expand Down
6 changes: 4 additions & 2 deletions integrationTests/vm/delegation/changeOwner_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build !race

package delegation

import (
Expand All @@ -23,6 +21,10 @@ var (
)

func TestDelegationChangeOwnerOnAccountHandler(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

t.Run("fix flag not activated, should not save - backwards compatibility", func(t *testing.T) {
_, _, userAccount := testDelegationChangeOwnerOnAccountHandler(t, 1)

Expand Down
10 changes: 8 additions & 2 deletions integrationTests/vm/delegation/delegationMulti_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build !race

package delegation

import (
Expand All @@ -19,6 +17,10 @@ import (
)

func TestDelegationSystemClaimMulti(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

tpn := integrationTests.NewTestProcessorNode(integrationTests.ArgTestProcessorNode{
MaxShards: 1,
NodeShardId: core.MetachainShardId,
Expand Down Expand Up @@ -127,6 +129,10 @@ func TestDelegationSystemClaimMulti(t *testing.T) {
}

func TestDelegationSystemRedelegateMulti(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
}

tpn := integrationTests.NewTestProcessorNode(integrationTests.ArgTestProcessorNode{
MaxShards: 1,
NodeShardId: core.MetachainShardId,
Expand Down
Loading

0 comments on commit b70bd26

Please sign in to comment.