diff --git a/.github/workflows/nightly-tests.yml b/.github/workflows/nightly-tests.yml index 7bce8668a..a3a6de7eb 100644 --- a/.github/workflows/nightly-tests.yml +++ b/.github/workflows/nightly-tests.yml @@ -16,23 +16,11 @@ concurrency: cancel-in-progress: true jobs: - integration: + main: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: 1.21 - - - name: Run go mod - run: make go.sum - - - name: Run TestIntegrationTest - run: go test -mod=readonly -v -run TestIntegrationTest ./tests - env: - TEST_INTEGRATION: true - - - name: Run TestCrosschainKeeperTestSuite - run: go test -mod=readonly -v -run TestCrosschainKeeperTestSuite ./x/crosschain/... - env: - TEST_INTEGRATION: true \ No newline at end of file + - run: make test-nightly diff --git a/Makefile b/Makefile index 91a9c903f..d949c5fd3 100644 --- a/Makefile +++ b/Makefile @@ -176,6 +176,10 @@ test: test-count: go test -mod=readonly -cpu 1 -count 1 -cover ./... | grep -v 'types\|cli\|no test files' +test-nightly: + @TEST_INTEGRATION=true go test -mod=readonly -v -run TestIntegrationTest ./tests + @TEST_CROSSCHAIN=true go test -mod=readonly -v -run TestCrosschainKeeperTestSuite ./x/crosschain/... + .PHONY: test ############################################################################### diff --git a/tests/integration_test.go b/tests/integration_test.go index 422f1a8e3..3f4f12e65 100644 --- a/tests/integration_test.go +++ b/tests/integration_test.go @@ -2,12 +2,18 @@ package tests import ( "os" + "runtime" "testing" "github.com/stretchr/testify/suite" + arbitrumtypes "github.com/functionx/fx-core/v7/x/arbitrum/types" + avalanchetypes "github.com/functionx/fx-core/v7/x/avalanche/types" bsctypes "github.com/functionx/fx-core/v7/x/bsc/types" ethtypes "github.com/functionx/fx-core/v7/x/eth/types" + layer2types "github.com/functionx/fx-core/v7/x/layer2/types" + optimismtypes "github.com/functionx/fx-core/v7/x/optimism/types" + polygontypes "github.com/functionx/fx-core/v7/x/polygon/types" trontypes "github.com/functionx/fx-core/v7/x/tron/types" ) @@ -26,20 +32,35 @@ func TestIntegrationTest(t *testing.T) { } testSuite := NewTestSuite() - suite.Run(t, &IntegrationTest{ + testingSuite := &IntegrationTest{ TestSuite: testSuite, crosschain: []CrosschainTestSuite{ NewCrosschainWithTestSuite(ethtypes.ModuleName, testSuite), NewCrosschainWithTestSuite(bsctypes.ModuleName, testSuite), NewCrosschainWithTestSuite(trontypes.ModuleName, testSuite), - // NewCrosschainWithTestSuite(polygontypes.ModuleName, testSuite), - // NewCrosschainWithTestSuite(avalanchetypes.ModuleName, testSuite), }, erc20: NewErc20TestSuite(testSuite), evm: NewEvmTestSuite(testSuite), staking: NewStakingSuite(testSuite), precompile: NewPrecompileTestSuite(testSuite), - }) + } + if runtime.GOOS == "linux" { + evmChainModules := []string{ + polygontypes.ModuleName, + avalanchetypes.ModuleName, + arbitrumtypes.ModuleName, + optimismtypes.ModuleName, + layer2types.ModuleName, + } + for _, module := range evmChainModules { + testingSuite.crosschain = append( + testingSuite.crosschain, + NewCrosschainWithTestSuite(module, testSuite), + ) + } + } + + suite.Run(t, testingSuite) } func (suite *IntegrationTest) TestRun() { diff --git a/x/crosschain/keeper/keeper_test.go b/x/crosschain/keeper/keeper_test.go index 34765db5d..dd982531b 100644 --- a/x/crosschain/keeper/keeper_test.go +++ b/x/crosschain/keeper/keeper_test.go @@ -27,6 +27,7 @@ import ( "github.com/functionx/fx-core/v7/x/crosschain/keeper" "github.com/functionx/fx-core/v7/x/crosschain/types" ethtypes "github.com/functionx/fx-core/v7/x/eth/types" + layer2types "github.com/functionx/fx-core/v7/x/layer2/types" optimismtypes "github.com/functionx/fx-core/v7/x/optimism/types" polygontypes "github.com/functionx/fx-core/v7/x/polygon/types" tronkeeper "github.com/functionx/fx-core/v7/x/tron/keeper" @@ -49,21 +50,19 @@ func TestCrosschainKeeperTestSuite(t *testing.T) { compile := regexp.MustCompile("^Test") mustTestModule := []string{ trontypes.ModuleName, - } - otherModules := []string{ ethtypes.ModuleName, - bsctypes.ModuleName, - polygontypes.ModuleName, - avalanchetypes.ModuleName, - arbitrumtypes.ModuleName, - optimismtypes.ModuleName, } subModules := mustTestModule - if os.Getenv("TEST_INTEGRATION") != "true" { - subModules = append(subModules, otherModules[tmrand.Int63n(int64(len(otherModules)))]) - } else { - subModules = append(subModules, otherModules...) + if os.Getenv("TEST_CROSSCHAIN") == "true" { + subModules = append(subModules, []string{ + bsctypes.ModuleName, + polygontypes.ModuleName, + avalanchetypes.ModuleName, + arbitrumtypes.ModuleName, + optimismtypes.ModuleName, + layer2types.ModuleName, + }...) } for _, moduleName := range subModules {