Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
ci: separate out rpc and integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prajjwol committed Feb 9, 2022
1 parent 04f595d commit f67b7f8
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
.sum
- run: |
make build
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
2 changes: 1 addition & 1 deletion .github/workflows/deploy-contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
run: |
sudo make contract-tools
sudo make test-contract
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
24 changes: 22 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
19 changes: 14 additions & 5 deletions scripts/integration-test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
6 changes: 3 additions & 3 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
6 changes: 4 additions & 2 deletions tests/e2e/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit f67b7f8

Please sign in to comment.