aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2019-04-23 13:28:36 +0800
committerGitHub <noreply@github.com>2019-04-23 13:28:36 +0800
commit9cee26e7f80238fd8a53ddb200c83f14c1dfda6e (patch)
treebe139e4693ec0c7a2ec2758d5cd7179202fd728d
parent3d09a2650959463ace37c9cc705e408ab48b4ef6 (diff)
downloaddexon-9cee26e7f80238fd8a53ddb200c83f14c1dfda6e.tar.gz
dexon-9cee26e7f80238fd8a53ddb200c83f14c1dfda6e.tar.zst
dexon-9cee26e7f80238fd8a53ddb200c83f14c1dfda6e.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.yml7
-rwxr-xr-xbuild/setup_recovery_env.sh16
-rwxr-xr-xtest/run_test.sh28
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