Ultimate E2E tests (#158)
* Ultimate e2e for native to erc type of bridge * One job * Try to run the tests * Run on CI * Docs * Cosmetics * Final changes * Revert the changes * Networks * Waiting for Oracle * One job * Initialize the contracts submodule * Run on ci * comment * Sleep. * ultimate network * Docker localhost no longer needed * Final changes * Timeout * Naming * Sleep task.
This commit is contained in:
parent
5c92cf50d7
commit
c9d100491c
@ -134,11 +134,32 @@ jobs:
|
|||||||
docker_layer_caching: true
|
docker_layer_caching: true
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Install redis tools
|
||||||
|
command: sudo apt-get install -y redis-tools
|
||||||
- run: git submodule update --init
|
- run: git submodule update --init
|
||||||
- run:
|
- run:
|
||||||
name: Prepare the infrastructure
|
name: Prepare the infrastructure
|
||||||
command: e2e-commons/up.sh deploy native-to-erc
|
command: e2e-commons/up.sh deploy native-to-erc
|
||||||
- run: 'echo "TODO - Run the e2e tests on top of the infrastructure created by previous step"'
|
no_output_timeout: 30m
|
||||||
|
- run:
|
||||||
|
name: Wait for the Oracle to start
|
||||||
|
command: |
|
||||||
|
set +e
|
||||||
|
i=0
|
||||||
|
while [[ $(redis-cli GET native-erc-collected-signatures:lastProcessedBlock) = "" ]]; do
|
||||||
|
((i++))
|
||||||
|
if [ "$i" -gt 30 ]
|
||||||
|
then
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Sleeping..."
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
- run:
|
||||||
|
name: Run the oracle-e2e tests
|
||||||
|
command: cd e2e-commons && docker-compose run e2e yarn workspace oracle-e2e run native-to-erc
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
tokenbridge:
|
tokenbridge:
|
||||||
|
@ -30,3 +30,7 @@ Scenario | Description
|
|||||||
--- | ---
|
--- | ---
|
||||||
oracle | Deploys and checks standalone Oracle on Ubuntu host
|
oracle | Deploys and checks standalone Oracle on Ubuntu host
|
||||||
ui | Deploys and checks standalone UI on Ubuntu host
|
ui | Deploys and checks standalone UI on Ubuntu host
|
||||||
|
|
||||||
|
## Ultimate E2E tests
|
||||||
|
|
||||||
|
For information on the Ultimate tests, please refer to [Ultimate](../../e2e-commons/ULTIMATE.md).
|
||||||
|
@ -7,6 +7,5 @@ services:
|
|||||||
dockerfile: molecule/Dockerfile
|
dockerfile: molecule/Dockerfile
|
||||||
restart: 'no'
|
restart: 'no'
|
||||||
privileged: true
|
privileged: true
|
||||||
network_mode: host
|
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
@ -3,10 +3,9 @@ cd $(dirname $0)
|
|||||||
set -e # exit when any command fails
|
set -e # exit when any command fails
|
||||||
|
|
||||||
CODEBASE_BRANCH=${CIRCLE_BRANCH-$(git symbolic-ref --short HEAD)}
|
CODEBASE_BRANCH=${CIRCLE_BRANCH-$(git symbolic-ref --short HEAD)}
|
||||||
DOCKER_LOCALHOST=${DOCKER_LOCALHOST-localhost}
|
|
||||||
|
|
||||||
while [ "$1" != "" ]; do
|
while [ "$1" != "" ]; do
|
||||||
docker-compose build && docker-compose run -e CODEBASE_BRANCH=$CODEBASE_BRANCH -e DOCKER_LOCALHOST=$DOCKER_LOCALHOST molecule_runner /bin/bash -c "molecule test --scenario-name $1"
|
docker-compose build && docker-compose run -e CODEBASE_BRANCH=$CODEBASE_BRANCH molecule_runner /bin/bash -c "molecule test --scenario-name $1"
|
||||||
|
|
||||||
shift # Shift all the parameters down by one
|
shift # Shift all the parameters down by one
|
||||||
done
|
done
|
||||||
|
3
deployment/molecule/ultimate-native-to-erc/converge.yml
Normal file
3
deployment/molecule/ultimate-native-to-erc/converge.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
- import_playbook: ../../site.yml
|
||||||
|
- import_playbook: ./overwrite-docker-compose.yml
|
@ -16,7 +16,7 @@ provisioner:
|
|||||||
name: ansible
|
name: ansible
|
||||||
playbooks:
|
playbooks:
|
||||||
prepare: ../prepare.yml
|
prepare: ../prepare.yml
|
||||||
converge: ../../site.yml
|
converge: converge.yml
|
||||||
inventory:
|
inventory:
|
||||||
host_vars:
|
host_vars:
|
||||||
oracle-native-to-erc-host:
|
oracle-native-to-erc-host:
|
||||||
@ -26,10 +26,8 @@ provisioner:
|
|||||||
HOME_BRIDGE_ADDRESS: "0x32198D570fffC7033641F8A9094FFDCaAEF42624"
|
HOME_BRIDGE_ADDRESS: "0x32198D570fffC7033641F8A9094FFDCaAEF42624"
|
||||||
FOREIGN_BRIDGE_ADDRESS: "0x2B6871b9B02F73fa24F4864322CdC78604207769"
|
FOREIGN_BRIDGE_ADDRESS: "0x2B6871b9B02F73fa24F4864322CdC78604207769"
|
||||||
ERC20_TOKEN_ADDRESS: "0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B"
|
ERC20_TOKEN_ADDRESS: "0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B"
|
||||||
QUEUE_URL: "amqp://$DOCKER_LOCALHOST"
|
HOME_RPC_URL: "http://parity1:8545"
|
||||||
REDIS_URL: "redis://$DOCKER_LOCALHOST:6379"
|
FOREIGN_RPC_URL: "http://parity2:8545"
|
||||||
HOME_RPC_URL: "http://$DOCKER_LOCALHOST:8541"
|
|
||||||
FOREIGN_RPC_URL: "http://$DOCKER_LOCALHOST:8542"
|
|
||||||
ALLOW_HTTP: yes
|
ALLOW_HTTP: yes
|
||||||
LOG_LEVEL: debug
|
LOG_LEVEL: debug
|
||||||
verifier:
|
verifier:
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
# The Oracle's docker-compose file has to be modified, in order to join the docker containers over network with the parity containers
|
||||||
|
- name: Overwrite the docker-compose
|
||||||
|
hosts: oracle
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
- name: stop the service
|
||||||
|
shell: service poabridge stop
|
||||||
|
|
||||||
|
- name: Slurp docker compose file
|
||||||
|
slurp:
|
||||||
|
src: "/home/poadocker/bridge/oracle/docker-compose.yml"
|
||||||
|
register: docker_compose_slurp
|
||||||
|
- name: Parse docker compose file
|
||||||
|
set_fact:
|
||||||
|
docker_compose_parsed: "{{ docker_compose_slurp['content'] | b64decode | from_yaml }}"
|
||||||
|
|
||||||
|
- name: Add the external network used to connect to Parity nodes
|
||||||
|
set_fact:
|
||||||
|
docker_compose_parsed: "{{ docker_compose_parsed |combine({'networks': {'ultimate': {'external': 'true'}}}, recursive=True) }}"
|
||||||
|
|
||||||
|
- name: Add all Oracle containers to the network
|
||||||
|
set_fact:
|
||||||
|
docker_compose_parsed: "{{ docker_compose_parsed | combine({'services': {item: {'networks': docker_compose_parsed.services[item].networks | union(['ultimate'])}}}, recursive=True) }}"
|
||||||
|
with_items: "{{ docker_compose_parsed.services }}"
|
||||||
|
|
||||||
|
- name: Expose Redis port to allow connecting from redis-cli
|
||||||
|
set_fact:
|
||||||
|
docker_compose_parsed: "{{ docker_compose_parsed | combine({'services': {'redis': {'ports': ['6379:6379']}}}, recursive=True) }}"
|
||||||
|
|
||||||
|
- name: Write new docker-compose file
|
||||||
|
copy:
|
||||||
|
content: "{{ docker_compose_parsed | to_yaml }}"
|
||||||
|
dest: "/home/poadocker/bridge/oracle/docker-compose.yml"
|
||||||
|
|
||||||
|
- name: start the service
|
||||||
|
shell: service poabridge start
|
@ -6,3 +6,7 @@
|
|||||||
force: no
|
force: no
|
||||||
update: no
|
update: no
|
||||||
version: "{{ bridge_repo_branch }}"
|
version: "{{ bridge_repo_branch }}"
|
||||||
|
- name: Initialize submodules
|
||||||
|
shell: git submodule update --init
|
||||||
|
args:
|
||||||
|
chdir: "{{ bridge_path }}"
|
||||||
|
@ -25,3 +25,7 @@ Shut down and cleans up containers, networks, services, running scripts:
|
|||||||
| ui | Launches UI containers |
|
| ui | Launches UI containers |
|
||||||
| blocks | Auto mines blocks |
|
| blocks | Auto mines blocks |
|
||||||
| native-to-erc | Creates infrastructure for ultimate e2e testing, for native-to-erc type of bridge |
|
| native-to-erc | Creates infrastructure for ultimate e2e testing, for native-to-erc type of bridge |
|
||||||
|
|
||||||
|
#### Ultimate e2e testing
|
||||||
|
|
||||||
|
For more information on the Ultimate e2e testing, please refer to [Ultimate](./ULTIMATE.md).
|
||||||
|
29
e2e-commons/ULTIMATE.md
Normal file
29
e2e-commons/ULTIMATE.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# POA TokenBridge / Ultimate E2E
|
||||||
|
|
||||||
|
Documentation regarding the Ultimate end-to-end tests.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The ultimate e2e test scenario covers native-to-erc type of bridge.
|
||||||
|
It runs the e2e tests on components deployed using the deployment playbooks.
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### 1. Prepare the infrastructure
|
||||||
|
|
||||||
|
Run the Parity nodes, deploy the bridge contracts, deploy Oracle using the deployment playbook.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./up.sh deploy native-to-erc
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Run the E2E tests
|
||||||
|
|
||||||
|
```
|
||||||
|
docker-compose run e2e yarn workspace oracle-e2e run native-to-erc
|
||||||
|
```
|
||||||
|
|
||||||
|
## Diagram
|
||||||
|
|
||||||
|
![diagram](./ultimate.png)
|
@ -1,22 +1,33 @@
|
|||||||
---
|
---
|
||||||
version: '3'
|
version: '3'
|
||||||
|
networks:
|
||||||
|
ultimate:
|
||||||
|
external: true
|
||||||
services:
|
services:
|
||||||
parity1:
|
parity1:
|
||||||
build: ../parity
|
build: ../parity
|
||||||
ports:
|
ports:
|
||||||
- "8541:8545"
|
- "8541:8545"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
parity2:
|
parity2:
|
||||||
build:
|
build:
|
||||||
context: ../parity
|
context: ../parity
|
||||||
dockerfile: Dockerfile-foreign
|
dockerfile: Dockerfile-foreign
|
||||||
ports:
|
ports:
|
||||||
- "8542:8545"
|
- "8542:8545"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
redis:
|
redis:
|
||||||
image: "redis:4"
|
image: "redis:4"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
rabbit:
|
rabbit:
|
||||||
image: "rabbitmq:3-management"
|
image: "rabbitmq:3-management"
|
||||||
ports:
|
ports:
|
||||||
- "15672:15672"
|
- "15672:15672"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
oracle:
|
oracle:
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
@ -47,6 +58,8 @@ services:
|
|||||||
- FOREIGN_POLLING_INTERVAL=500
|
- FOREIGN_POLLING_INTERVAL=500
|
||||||
- ALLOW_HTTP=yes
|
- ALLOW_HTTP=yes
|
||||||
command: "true"
|
command: "true"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
oracle-erc20:
|
oracle-erc20:
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
@ -78,6 +91,8 @@ services:
|
|||||||
- FOREIGN_POLLING_INTERVAL=500
|
- FOREIGN_POLLING_INTERVAL=500
|
||||||
- ALLOW_HTTP=yes
|
- ALLOW_HTTP=yes
|
||||||
command: "true"
|
command: "true"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
oracle-erc20-native:
|
oracle-erc20-native:
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
@ -109,6 +124,8 @@ services:
|
|||||||
- FOREIGN_POLLING_INTERVAL=500
|
- FOREIGN_POLLING_INTERVAL=500
|
||||||
- ALLOW_HTTP=yes
|
- ALLOW_HTTP=yes
|
||||||
command: "true"
|
command: "true"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
ui:
|
ui:
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
@ -137,6 +154,8 @@ services:
|
|||||||
- REACT_APP_FOREIGN_GAS_PRICE_FACTOR=1
|
- REACT_APP_FOREIGN_GAS_PRICE_FACTOR=1
|
||||||
- PORT=3000
|
- PORT=3000
|
||||||
command: "true"
|
command: "true"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
ui-erc20:
|
ui-erc20:
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
@ -165,6 +184,8 @@ services:
|
|||||||
- REACT_APP_FOREIGN_GAS_PRICE_FACTOR=1
|
- REACT_APP_FOREIGN_GAS_PRICE_FACTOR=1
|
||||||
- PORT=3000
|
- PORT=3000
|
||||||
command: "true"
|
command: "true"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
ui-erc20-native:
|
ui-erc20-native:
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
@ -193,6 +214,8 @@ services:
|
|||||||
- REACT_APP_FOREIGN_GAS_PRICE_FACTOR=1
|
- REACT_APP_FOREIGN_GAS_PRICE_FACTOR=1
|
||||||
- PORT=3000
|
- PORT=3000
|
||||||
command: "true"
|
command: "true"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
monitor:
|
monitor:
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
@ -219,8 +242,12 @@ services:
|
|||||||
entrypoint: yarn start
|
entrypoint: yarn start
|
||||||
ports:
|
ports:
|
||||||
- "3003:3003"
|
- "3003:3003"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
e2e:
|
e2e:
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
dockerfile: Dockerfile.e2e
|
dockerfile: Dockerfile.e2e
|
||||||
command: "true"
|
command: "true"
|
||||||
|
networks:
|
||||||
|
- ultimate
|
||||||
|
@ -5,3 +5,4 @@ if [ $CI ]; then exit $rc; fi
|
|||||||
|
|
||||||
ps | grep node | grep -v grep | awk '{print "kill " $1}' | /bin/bash
|
ps | grep node | grep -v grep | awk '{print "kill " $1}' | /bin/bash
|
||||||
docker-compose down
|
docker-compose down
|
||||||
|
docker network rm ultimate || true
|
||||||
|
BIN
e2e-commons/ultimate.png
Normal file
BIN
e2e-commons/ultimate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 259 KiB |
@ -4,14 +4,10 @@ set -e # exit when any command fails
|
|||||||
|
|
||||||
./down.sh
|
./down.sh
|
||||||
docker-compose build
|
docker-compose build
|
||||||
|
docker network create --driver bridge ultimate || true
|
||||||
docker-compose up -d parity1 parity2 e2e
|
docker-compose up -d parity1 parity2 e2e
|
||||||
export DOCKER_LOCALHOST="localhost"
|
|
||||||
|
|
||||||
while [ "$1" != "" ]; do
|
while [ "$1" != "" ]; do
|
||||||
if [ "$1" == "macos" ]; then
|
|
||||||
export DOCKER_LOCALHOST="host.docker.internal"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$1" == "oracle" ]; then
|
if [ "$1" == "oracle" ]; then
|
||||||
docker-compose up -d redis rabbit oracle oracle-erc20 oracle-erc20-native
|
docker-compose up -d redis rabbit oracle oracle-erc20 oracle-erc20-native
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "mocha",
|
"start": "mocha",
|
||||||
"lint": "eslint . --ignore-path ../.eslintignore"
|
"lint": "eslint . --ignore-path ../.eslintignore",
|
||||||
|
"native-to-erc": "mocha test/nativeToErc.js"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
Loading…
Reference in New Issue
Block a user