diff options
author | Sonic <sonic@dexon.org> | 2019-04-23 13:28:36 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-15 22:09:56 +0800 |
commit | 2b2f301c7827bede218b67b2bad8d354a8ef63be (patch) | |
tree | c98d9bd4468c988671541132c7116bcd3a2ffcb9 | |
parent | 5638018dcb287c5b176ed408d811d992915ac2af (diff) | |
download | go-tangerine-2b2f301c7827bede218b67b2bad8d354a8ef63be.tar go-tangerine-2b2f301c7827bede218b67b2bad8d354a8ef63be.tar.gz go-tangerine-2b2f301c7827bede218b67b2bad8d354a8ef63be.tar.bz2 go-tangerine-2b2f301c7827bede218b67b2bad8d354a8ef63be.tar.lz go-tangerine-2b2f301c7827bede218b67b2bad8d354a8ef63be.tar.xz go-tangerine-2b2f301c7827bede218b67b2bad8d354a8ef63be.tar.zst go-tangerine-2b2f301c7827bede218b67b2bad8d354a8ef63be.zip |
test: run smoke test on ganache (#388)
* test: run smoke test on ganache
* Update build/setup_recovery_env.sh
Co-Authored-By: Jsying <sonic@dexon.org>
* Update build/setup_recovery_env.sh
Co-Authored-By: Jsying <sonic@dexon.org>
-rw-r--r-- | .travis.yml | 7 | ||||
-rwxr-xr-x | build/setup_recovery_env.sh | 16 | ||||
-rwxr-xr-x | test/run_test.sh | 28 |
3 files changed, 44 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml index 46233a9b9..4b5623636 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,14 +59,17 @@ matrix: git: submodules: false script: + - cd build + - ./setup_recovery_env.sh + - cd .. - make gdex - cd test - - ./run_test.sh --ignore-log + - ./run_test.sh --smoke-test - cd .. - ./build/fullnode-test.sh - pkill -15 -f gdex - cd test - - ./run_test.sh --continue --ignore-log + - ./run_test.sh --continue --smoke-test - cd .. - ./build/recovery-test.sh diff --git a/build/setup_recovery_env.sh b/build/setup_recovery_env.sh new file mode 100755 index 000000000..5586273c8 --- /dev/null +++ b/build/setup_recovery_env.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +accounts_opt="--account=0x`cat ../test/keystore/monkey.key`,100000000000000000000" + +# node key's account +for key in ../test/keystore/test*key; do + accounts_opt+=" --account=0x`cat $key`,1000000000000000000000" +done + +git clone --depth 1 -b master https://github.com/dexon-foundation/governance-abi + +# deploy contract +cd governance-abi +npm ci +./node_modules/.bin/ganache-cli -p 8645 -b 5 $accounts_opt > ../../test/ganache.log 2>&1 & +./node_modules/.bin/truffle migrate --network=smoke diff --git a/test/run_test.sh b/test/run_test.sh index 1f19caa6a..0aecf3b6e 100755 --- a/test/run_test.sh +++ b/test/run_test.sh @@ -8,14 +8,14 @@ BOOTNODE="../build/bin/bootnode" CONTINUE=false -IGNORELOG=false +SMOKETEST=false while [[ $# -gt 0 ]]; do case "$1" in --continue) CONTINUE=true ;; - --ignore-log) - IGNORELOG=true + --smoke-test) + SMOKETEST=true ;; esac shift @@ -44,6 +44,17 @@ fi rm -f log-latest ln -s $logsdir log-latest + +# the recovery contract address 0x80859F3d0D781c2c4126962cab0c977b37820e78 is deployed using keystore/monkey.key +if $SMOKETEST; then + if [ `uname` == "Darwin" ]; then + sed -i '' 's/"contract":.*,/"contract": "0x80859F3d0D781c2c4126962cab0c977b37820e78",/g' genesis.json + else + sed -i 's/"contract":.*,/"contract": "0x80859F3d0D781c2c4126962cab0c977b37820e78",/g' genesis.json + fi +fi + + python << __FILE__ import re import time @@ -76,6 +87,13 @@ $GDEX \ NUM_NODES=$(cat ${GENESIS} | grep 'DEXON Test Node' | wc -l) +RECOVERY_FLAGS="--recovery.network-rpc=https://rinkeby.infura.io" + +if $SMOKETEST; then + RECOVERY_FLAGS="--recovery.network-rpc=http://127.0.0.1:8645" +fi + + # Nodes for i in $(seq 0 $(($NUM_NODES - 1))); do datadir=$PWD/Dexon.$i @@ -91,7 +109,7 @@ for i in $(seq 0 $(($NUM_NODES - 1))); do --gcmode=archive \ --datadir=$datadir --nodekey=keystore/test$i.key \ --port=$((30305 + $i)) \ - --recovery.network-rpc="https://rinkeby.infura.io" \ + ${RECOVERY_FLAGS} \ --rpc --rpcapi=eth,net,web3,debug \ --rpcaddr=0.0.0.0 --rpcport=$((8547 + $i * 2)) \ --ws --wsapi=eth,net,web3,debug \ @@ -101,6 +119,6 @@ for i in $(seq 0 $(($NUM_NODES - 1))); do > $logsdir/gdex.$i.log 2>&1 & done -if ! $IGNORELOG; then +if ! $SMOKETEST; then tail -f $logsdir/gdex.*.log fi |