Extending monitor-e2e with 3 types of bridge (#170)

* Started working on monitor-e2e

* Monitor e2e tests extended for 3 types of bridge

* Skipp error checking

* bash fix

* Fixed docker-compose

* check first

* grep errors

* all jobs

* Style

* Executing instead of sourcing
This commit is contained in:
Przemyslaw Rzad 2019-08-01 10:26:20 +02:00 committed by GitHub
parent 414fe9cb65
commit a2e9dae43d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 151 additions and 29 deletions

@ -238,10 +238,66 @@ services:
- FOREIGN_GAS_PRICE_FALLBACK=1000000000 - FOREIGN_GAS_PRICE_FALLBACK=1000000000
- FOREIGN_GAS_PRICE_FACTOR=1 - FOREIGN_GAS_PRICE_FACTOR=1
- LEFT_TX_THRESHOLD=100 - LEFT_TX_THRESHOLD=100
- PORT=3003 - PORT=3010
entrypoint: yarn start entrypoint: yarn start
ports: ports:
- "3003:3003" - "3010:3010"
networks:
- ultimate
monitor-erc20:
build:
context: ..
dockerfile: monitor/Dockerfile
environment:
- HOME_RPC_URL=http://parity1:8545
- FOREIGN_RPC_URL=http://parity2:8545
- HOME_BRIDGE_ADDRESS=0x1feB40aD9420b186F019A717c37f5546165d411E
- FOREIGN_BRIDGE_ADDRESS=0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127
- HOME_DEPLOYMENT_BLOCK=0
- FOREIGN_DEPLOYMENT_BLOCK=0
- HOME_GAS_LIMIT=300000
- HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- HOME_GAS_PRICE_SPEED_TYPE=standard
- HOME_GAS_PRICE_FALLBACK=1000000000
- HOME_GAS_PRICE_FACTOR=1
- FOREIGN_GAS_LIMIT=300000
- FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- FOREIGN_GAS_PRICE_FALLBACK=1000000000
- FOREIGN_GAS_PRICE_FACTOR=1
- LEFT_TX_THRESHOLD=100
- PORT=3011
entrypoint: yarn start
ports:
- "3011:3011"
networks:
- ultimate
monitor-erc20-native:
build:
context: ..
dockerfile: monitor/Dockerfile
environment:
- HOME_RPC_URL=http://parity1:8545
- FOREIGN_RPC_URL=http://parity2:8545
- HOME_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
- FOREIGN_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
- HOME_DEPLOYMENT_BLOCK=0
- FOREIGN_DEPLOYMENT_BLOCK=0
- HOME_GAS_LIMIT=300000
- HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- HOME_GAS_PRICE_SPEED_TYPE=standard
- HOME_GAS_PRICE_FALLBACK=1000000000
- HOME_GAS_PRICE_FACTOR=1
- FOREIGN_GAS_LIMIT=300000
- FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- FOREIGN_GAS_PRICE_FALLBACK=1000000000
- FOREIGN_GAS_PRICE_FACTOR=1
- LEFT_TX_THRESHOLD=100
- PORT=3012
entrypoint: yarn start
ports:
- "3012:3012"
networks: networks:
- ultimate - ultimate
e2e: e2e:

@ -41,7 +41,7 @@ while [ "$1" != "" ]; do
fi fi
if [ "$1" == "monitor" ]; then if [ "$1" == "monitor" ]; then
docker-compose up -d monitor docker-compose up -d monitor monitor-erc20 monitor-erc20-native
fi fi
if [ "$1" == "native-to-erc" ]; then if [ "$1" == "native-to-erc" ]; then

26
monitor-e2e/erc-to-erc.sh Executable file

@ -0,0 +1,26 @@
set -e # exit when any command fails
echo "MONITOR E2E - ERC TO ERC"
export URL=localhost:3011
echo "Test case - Web Interface should return balances"
OUTPUT=$(curl -s http://$URL/)
grep -q home <<< "$OUTPUT"
grep -q foreign <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return validators"
OUTPUT=$(curl -s http://$URL/validators)
grep -q home <<< "$OUTPUT"
grep -q foreign <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return eventsStats"
OUTPUT=$(curl -s http://$URL/eventsStats)
grep -q lastChecked <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return alerts"
OUTPUT=$(curl -s http://$URL/alerts)
grep -q lastChecked <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")

26
monitor-e2e/erc-to-native.sh Executable file

@ -0,0 +1,26 @@
set -e # exit when any command fails
echo "MONITOR E2E - ERC TO NATIVE"
export URL=localhost:3012
echo "Test case - Web Interface should return balances"
OUTPUT=$(curl -s http://$URL/)
grep -q home <<< "$OUTPUT"
grep -q foreign <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return validators"
OUTPUT=$(curl -s http://$URL/validators)
grep -q home <<< "$OUTPUT"
grep -q foreign <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return eventsStats"
OUTPUT=$(curl -s http://$URL/eventsStats)
grep -q lastChecked <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return alerts"
OUTPUT=$(curl -s http://$URL/alerts)
grep -q lastChecked <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")

26
monitor-e2e/native-to-erc.sh Executable file

@ -0,0 +1,26 @@
set -e # exit when any command fails
echo "MONITOR E2E - NATIVE TO ERC"
export URL="localhost:3010"
echo "Test case - Web Interface should return balances"
OUTPUT=$(curl -s http://$URL/)
grep -q home <<< "$OUTPUT"
grep -q foreign <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return validators"
OUTPUT=$(curl -s http://$URL/validators)
grep -q home <<< "$OUTPUT"
grep -q foreign <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return eventsStats"
OUTPUT=$(curl -s http://$URL/eventsStats)
grep -q lastChecked <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return alerts"
OUTPUT=$(curl -s http://$URL/alerts)
grep -q lastChecked <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")

@ -17,6 +17,8 @@ check_files_exist() {
for f in "${FILES[@]}"; do for f in "${FILES[@]}"; do
command="test -f responses/$f" command="test -f responses/$f"
(docker-compose -f ../e2e-commons/docker-compose.yml exec monitor /bin/bash -c "$command") || rc=1 (docker-compose -f ../e2e-commons/docker-compose.yml exec monitor /bin/bash -c "$command") || rc=1
(docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20 /bin/bash -c "$command") || rc=1
(docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20-native /bin/bash -c "$command") || rc=1
done done
return $rc return $rc
} }
@ -24,38 +26,24 @@ check_files_exist() {
##### Initialization ##### ##### Initialization #####
../e2e-commons/up.sh oracle deploy monitor ../e2e-commons/up.sh deploy oracle monitor
##### Initial checks #####
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor /bin/bash -c "yarn check-all"
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20 /bin/bash -c "yarn check-all"
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20-native /bin/bash -c "yarn check-all"
check_files_exist
##### Test cases ##### ##### Test cases #####
echo "Test case - CheckWorker scripts should work and create files in responses/ directory" ./native-to-erc.sh
(! check_files_exist)
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor /bin/bash -c "node checkWorker.js"
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor /bin/bash -c "node checkWorker2.js"
check_files_exist
echo "Test case - Web Interface should return balances" ./erc-to-erc.sh
OUTPUT=$(curl -s http://localhost:3003/)
grep -q home <<< "$OUTPUT"
grep -q foreign <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return validators" ./erc-to-native.sh
OUTPUT=$(curl -s http://localhost:3003/validators)
grep -q home <<< "$OUTPUT"
grep -q foreign <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return eventsStats"
OUTPUT=$(curl -s http://localhost:3003/eventsStats)
grep -q lastChecked <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
echo "Test case - Web Interface should return alerts"
OUTPUT=$(curl -s http://localhost:3003/alerts)
grep -q lastChecked <<< "$OUTPUT"
(! grep -q error <<< "$OUTPUT")
##### Cleanup ##### ##### Cleanup #####