diff --git a/e2e-commons/docker-compose.yml b/e2e-commons/docker-compose.yml index 1ad3f657..0f22b360 100644 --- a/e2e-commons/docker-compose.yml +++ b/e2e-commons/docker-compose.yml @@ -238,10 +238,66 @@ services: - FOREIGN_GAS_PRICE_FALLBACK=1000000000 - FOREIGN_GAS_PRICE_FACTOR=1 - LEFT_TX_THRESHOLD=100 - - PORT=3003 + - PORT=3010 entrypoint: yarn start 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: - ultimate e2e: diff --git a/e2e-commons/up.sh b/e2e-commons/up.sh index 2255b2dc..2f2c9f7e 100755 --- a/e2e-commons/up.sh +++ b/e2e-commons/up.sh @@ -41,7 +41,7 @@ while [ "$1" != "" ]; do fi if [ "$1" == "monitor" ]; then - docker-compose up -d monitor + docker-compose up -d monitor monitor-erc20 monitor-erc20-native fi if [ "$1" == "native-to-erc" ]; then diff --git a/monitor-e2e/erc-to-erc.sh b/monitor-e2e/erc-to-erc.sh new file mode 100755 index 00000000..eab3e13c --- /dev/null +++ b/monitor-e2e/erc-to-erc.sh @@ -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") diff --git a/monitor-e2e/erc-to-native.sh b/monitor-e2e/erc-to-native.sh new file mode 100755 index 00000000..62abe5fa --- /dev/null +++ b/monitor-e2e/erc-to-native.sh @@ -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") diff --git a/monitor-e2e/native-to-erc.sh b/monitor-e2e/native-to-erc.sh new file mode 100755 index 00000000..16c2c1bc --- /dev/null +++ b/monitor-e2e/native-to-erc.sh @@ -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") diff --git a/monitor-e2e/run-tests.sh b/monitor-e2e/run-tests.sh index c241b0ef..eb7b5179 100755 --- a/monitor-e2e/run-tests.sh +++ b/monitor-e2e/run-tests.sh @@ -17,6 +17,8 @@ check_files_exist() { for f in "${FILES[@]}"; do 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-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 return $rc } @@ -24,38 +26,24 @@ check_files_exist() { ##### 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 ##### -echo "Test case - CheckWorker scripts should work and create files in responses/ directory" -(! 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 +./native-to-erc.sh -echo "Test case - Web Interface should return balances" -OUTPUT=$(curl -s http://localhost:3003/) -grep -q home <<< "$OUTPUT" -grep -q foreign <<< "$OUTPUT" -(! grep -q error <<< "$OUTPUT") +./erc-to-erc.sh -echo "Test case - Web Interface should return validators" -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") +./erc-to-native.sh ##### Cleanup #####