From f67b7f8c0026b356e068652f260d4bb48e056464 Mon Sep 17 00:00:00 2001 From: Prajjwol Gautam Date: Tue, 8 Feb 2022 20:35:38 -0800 Subject: [PATCH] ci: separate out rpc and integration tests --- .github/workflows/build.yml | 2 +- .github/workflows/deploy-contract.yml | 2 +- .github/workflows/test.yml | 24 ++++++++++++++++++++++-- Makefile | 3 +++ scripts/integration-test-all.sh | 19 ++++++++++++++----- scripts/start.sh | 6 +++--- tests/e2e/integration_test.go | 6 ++++-- 7 files changed, 48 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ada108b604..aa88288119 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,4 +29,4 @@ jobs: .sum - run: | make build - if: "env.GIT_DIFF != ''" + if: env.GIT_DIFF diff --git a/.github/workflows/deploy-contract.yml b/.github/workflows/deploy-contract.yml index 41edf6330d..cfbb67e7a5 100644 --- a/.github/workflows/deploy-contract.yml +++ b/.github/workflows/deploy-contract.yml @@ -35,4 +35,4 @@ jobs: run: | sudo make contract-tools sudo make test-contract - if: "env.GIT_DIFF != ''" + if: env.GIT_DIFF diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bebcbe3aea..3f677b263e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,7 +73,7 @@ jobs: - name: test-importer run: | make test-import - if: "env.GIT_DIFF != ''" + if: env.GIT_DIFF test-solidity: runs-on: ubuntu-latest @@ -100,7 +100,7 @@ jobs: - name: test-solidity run: | ./scripts/run-solidity-tests.sh --batch=${{ matrix.batch }} - if: "env.GIT_DIFF != ''" + if: env.GIT_DIFF liveness-test: runs-on: ubuntu-latest @@ -150,3 +150,23 @@ jobs: run: | make test-rpc if: env.GIT_DIFF + + test-e2e: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/setup-go@v2.1.4 + with: + go-version: 1.17 + - uses: actions/checkout@v2.4.0 + - uses: technote-space/get-diff-action@v6.0.1 + with: + PATTERNS: | + **/**.sol + **/**.go + go.mod + go.sum + - name: Test e2e + run: | + make test-integration + if: env.GIT_DIFF \ No newline at end of file diff --git a/Makefile b/Makefile index 6580ad6ab4..de98980e4b 100755 --- a/Makefile +++ b/Makefile @@ -324,6 +324,9 @@ test-import: test-rpc: ./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 2 -m "rpc" -r "true" +test-integration: + ./scripts/integration-test-all.sh -t "integration" -q 1 -z 1 -s 2 -m "integration" -r "true" + test-rpc-pending: ./scripts/integration-test-all.sh -t "pending" -q 1 -z 1 -s 2 -m "pending" -r "true" diff --git a/scripts/integration-test-all.sh b/scripts/integration-test-all.sh index 421684b1d3..1522f219af 100755 --- a/scripts/integration-test-all.sh +++ b/scripts/integration-test-all.sh @@ -139,8 +139,18 @@ echo "done sleeping" set +e -if [[ -z $TEST || $TEST == "rpc" || $TEST == "pending" ]]; then +if [[ -z $TEST || $TEST == "integration" ]] ; then + time_out=300s + for i in $(seq 1 "$TEST_QTD"); do + HOST_RPC=http://$IP_ADDR:$RPC_PORT"$i" + echo "going to test ethermint node $HOST_RPC ..." + MODE=$MODE HOST=$HOST_RPC go test ./tests/e2e/... -timeout=$time_out -v -short + TEST_FAIL=$? + done +fi + +if [[ -z $TEST || $TEST == "rpc" || $TEST == "pending" ]]; then time_out=300s if [[ $TEST == "pending" ]]; then time_out=60m0s @@ -149,10 +159,9 @@ if [[ -z $TEST || $TEST == "rpc" || $TEST == "pending" ]]; then for i in $(seq 1 "$TEST_QTD"); do HOST_RPC=http://$IP_ADDR:$RPC_PORT"$i" echo "going to test ethermint node $HOST_RPC ..." - MODE=$MODE HOST=$HOST_RPC go test ./tests/e2e/... -timeout=$time_out -v -short MODE=$MODE HOST=$HOST_RPC go test ./tests/rpc/... -timeout=$time_out -v -short - RPC_FAIL=$? + TEST_FAIL=$? done fi @@ -175,8 +184,8 @@ for i in "${arr[@]}"; do stop_func "$i" done -if [[ (-z $TEST || $TEST == "rpc") && $RPC_FAIL -ne 0 ]]; then - exit $RPC_FAIL +if [[ (-z $TEST || $TEST == "rpc" || $TEST == "integration" ) && $TEST_FAIL -ne 0 ]]; then + exit $TEST_FAIL else exit 0 fi diff --git a/scripts/start.sh b/scripts/start.sh index 285ebda4af..c05bff709e 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -127,7 +127,7 @@ if [[ -z $TEST || $TEST == "rpc" ]]; then MODE=$MODE HOST=$HOST_RPC go test ./tests/e2e/... -timeout=300s -v -short MODE=$MODE HOST=$HOST_RPC go test ./tests/rpc/... -timeout=300s -v -short - RPC_FAIL=$? + TEST_FAIL=$? done fi @@ -150,8 +150,8 @@ for i in "${arr[@]}"; do stop_func "$i" done -if [[ (-z $TEST || $TEST == "rpc") && $RPC_FAIL -ne 0 ]]; then - exit $RPC_FAIL +if [[ (-z $TEST || $TEST == "rpc") && $TEST_FAIL -ne 0 ]]; then + exit $TEST_FAIL else exit 0 fi diff --git a/tests/e2e/integration_test.go b/tests/e2e/integration_test.go index 773f95acc0..3c09b86002 100644 --- a/tests/e2e/integration_test.go +++ b/tests/e2e/integration_test.go @@ -4,11 +4,12 @@ import ( "bytes" "context" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" - evmtypes "github.com/tharsis/ethermint/x/evm/types" "math/big" "testing" + sdk "github.com/cosmos/cosmos-sdk/types" + evmtypes "github.com/tharsis/ethermint/x/evm/types" + // . "github.com/onsi/ginkgo" // . "github.com/onsi/gomega" @@ -392,6 +393,7 @@ func (s *IntegrationTestSuite) TestGetLogs() { common.HexToHash("0x000000000000000000000000" + fmt.Sprintf("%x", common.BytesToAddress(s.network.Validators[0].Address))), common.HexToHash("0x000000000000000000000000378c50d9264c63f3f92b806d4ee56e9d86ffb3ec"), } + s.Require().Equal(expectedTopics, logs[0].Topics) }