test(integration)_: separate anvil from tests
This commit is contained in:
parent
10cf286208
commit
b2a184ea78
8
Makefile
8
Makefile
|
@ -477,3 +477,11 @@ build-verif-proxy-wrapper:
|
||||||
|
|
||||||
test-verif-proxy-wrapper:
|
test-verif-proxy-wrapper:
|
||||||
CGO_CFLAGS="$(CGO_CFLAGS)" go test -v github.com/status-im/status-go/rpc -tags gowaku_skip_migrations,nimbus_light_client -run ^TestProxySuite$$ -testify.m TestRun -ldflags $(LDFLAGS)
|
CGO_CFLAGS="$(CGO_CFLAGS)" go test -v github.com/status-im/status-go/rpc -tags gowaku_skip_migrations,nimbus_light_client -run ^TestProxySuite$$ -testify.m TestRun -ldflags $(LDFLAGS)
|
||||||
|
|
||||||
|
run-integration-tests: SHELL := /bin/sh
|
||||||
|
run-integration-tests:
|
||||||
|
docker-compose -f integration-tests/docker-compose.anvil.yml -f integration-tests/docker-compose.test.status-go.yml up --remove-orphans --build
|
||||||
|
|
||||||
|
run-anvil: SHELL := /bin/sh
|
||||||
|
run-anvil:
|
||||||
|
docker-compose -f integration-tests/docker-compose.anvil.yml up --remove-orphans
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
FROM ghcr.io/foundry-rs/foundry:latest
|
||||||
|
|
||||||
|
RUN apk update && \
|
||||||
|
apk add git
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY entrypoint.sh /app
|
||||||
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||||
|
WORKDIR /app/$GITHUB_REPO
|
|
@ -13,22 +13,23 @@ Integration tests for status-go
|
||||||
## How to Install
|
## How to Install
|
||||||
|
|
||||||
* Install [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/)
|
* Install [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/)
|
||||||
- Checkout all listed contract repositories into one folder:
|
|
||||||
- [Status Network Token V2](https://github.com/status-im/status-network-token-v2)
|
|
||||||
- [Communities Contracts](https://github.com/status-im/communities-contracts?tab=readme-ov-file#installation-and-development)
|
|
||||||
* Add environment variable, path to contract repos e.g. `export PATH_TO_CONTRACT_REPOS=~/directory-with-every-contract-repo`
|
|
||||||
* Install [Python 3.10.14](https://www.python.org/downloads/)
|
* Install [Python 3.10.14](https://www.python.org/downloads/)
|
||||||
* In `integration-tests` directory, run `pip install -r requirements.txt`
|
* In `integration-tests` directory, run `pip install -r requirements.txt`
|
||||||
* **Optional (for test development)**: Use Python virtual environment for better dependency management. You can follow the guide [here](https://akrabat.com/creating-virtual-environments-with-pyenv/):
|
* **Optional (for test development)**: Use Python virtual environment for better dependency management. You can follow the guide [here](https://akrabat.com/creating-virtual-environments-with-pyenv/):
|
||||||
|
|
||||||
## How to Run
|
## How to Run
|
||||||
|
|
||||||
- In `integration-tests/tests` run `docker compose up --build`, as result:
|
### Running dev RPC (anvil with contracts)
|
||||||
* a container with [status-go as deamon](https://github.com/status-im/status-go/issues/5175) will be created with APIModules exposed on `0.0.0.0:3333`
|
- In `integration-tests` run `docker compose -f docker-compose.anvil.yml up --remove-orphans --build`, as result:
|
||||||
* status-go will use [anvil](https://book.getfoundry.sh/reference/anvil/) as RPCURL with ChainID 31337
|
* an [anvil](https://book.getfoundry.sh/reference/anvil/) container with ChainID 31337 exposed on `0.0.0.0:8545` will start running
|
||||||
* also all Status-im contracts are going to be deployed to the new network
|
* all Status-im contracts will be deployed to the network
|
||||||
|
|
||||||
|
### Run tests
|
||||||
|
- In `integration-tests` run `docker compose -f docker-compose.anvil.yml -f docker-compose.test.status-go.yml up --remove-orphans`, as result:
|
||||||
|
* a container with [status-go as daemon](https://github.com/status-im/status-go/issues/5175) will be created with APIModules exposed on `0.0.0.0:3333`
|
||||||
|
* status-go will use [anvil](https://book.getfoundry.sh/reference/anvil/) as RPCURL with ChainID 31337
|
||||||
|
* all Status-im contracts will be deployed to the network
|
||||||
|
|
||||||
### Running Tests
|
|
||||||
* In `integration-tests/tests` directory run `pytest -m wallet`
|
* In `integration-tests/tests` directory run `pytest -m wallet`
|
||||||
|
|
||||||
## Implementation details
|
## Implementation details
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
services:
|
||||||
|
anvil:
|
||||||
|
image: ghcr.io/foundry-rs/foundry:latest
|
||||||
|
platform: linux/amd64
|
||||||
|
command:
|
||||||
|
- anvil --host 0.0.0.0
|
||||||
|
ports:
|
||||||
|
- 8545:8545
|
||||||
|
|
||||||
|
deploy-sntv2:
|
||||||
|
platform: linux/amd64
|
||||||
|
environment:
|
||||||
|
- API_KEY_ETHERSCAN="" # API_KEY env var is required, but value isn't used
|
||||||
|
- GITHUB_ORG=status-im
|
||||||
|
- GITHUB_REPO=status-network-token-v2
|
||||||
|
depends_on:
|
||||||
|
- anvil
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
command: |
|
||||||
|
forge script script/Deploy.s.sol
|
||||||
|
--broadcast
|
||||||
|
--fork-url=http://anvil:8545
|
||||||
|
--private-key=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
|
||||||
|
|
||||||
|
deploy-communities-contracts:
|
||||||
|
platform: linux/amd64
|
||||||
|
environment:
|
||||||
|
# API_KEY_* env vars are required, but values aren't used
|
||||||
|
- API_KEY_ETHERSCAN=""
|
||||||
|
- API_KEY_ARBISCAN=""
|
||||||
|
- API_KEY_OPTIMISTIC_ETHERSCAN=""
|
||||||
|
- GITHUB_ORG=status-im
|
||||||
|
- GITHUB_REPO=communities-contracts
|
||||||
|
depends_on:
|
||||||
|
deploy-sntv2:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
command: |
|
||||||
|
forge script script/DeployContracts.s.sol
|
||||||
|
--broadcast
|
||||||
|
--fork-url=http://anvil:8545
|
||||||
|
--private-key=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
|
||||||
|
--sender=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
|
|
@ -0,0 +1,16 @@
|
||||||
|
services:
|
||||||
|
status-go:
|
||||||
|
build:
|
||||||
|
context: ../
|
||||||
|
dockerfile: _assets/build/Dockerfile
|
||||||
|
args:
|
||||||
|
build_tags: gowaku_no_rln
|
||||||
|
build_target: statusd
|
||||||
|
build_flags: -ldflags="-X github.com/status-im/status-go/params.Version= -X github.com/status-im/status-go/params.GitCommit=11f83780d -X github.com/status-im/status-go/params.IpfsGatewayURL=https://ipfs.status.im/ -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true"
|
||||||
|
ports:
|
||||||
|
- 3333:3333
|
||||||
|
- 8080:8080
|
||||||
|
- 30303:30303
|
||||||
|
- 30303:30303/udp
|
||||||
|
- 30304:30304/udp
|
||||||
|
entrypoint: ["statusd", "-c", "/static/configs/config.json", "--seed-phrase=test test test test test test test test test test test junk", "--password=Strong12345"]
|
|
@ -1,56 +0,0 @@
|
||||||
services:
|
|
||||||
|
|
||||||
anvil:
|
|
||||||
image: ghcr.io/foundry-rs/foundry:latest
|
|
||||||
platform: linux/amd64
|
|
||||||
command:
|
|
||||||
- anvil --host 0.0.0.0
|
|
||||||
ports:
|
|
||||||
- 8545:8545
|
|
||||||
|
|
||||||
deploy-sntv2:
|
|
||||||
environment:
|
|
||||||
- API_KEY_ETHERSCAN="" # value isn't used, but env var is required
|
|
||||||
depends_on:
|
|
||||||
- anvil
|
|
||||||
image: ghcr.io/foundry-rs/foundry:latest
|
|
||||||
platform: linux/amd64
|
|
||||||
working_dir: /usr/local/bin/status-network-token-v2
|
|
||||||
command:
|
|
||||||
- forge clean && forge build && forge script script/Deploy.s.sol --broadcast --fork-url http://anvil:8545 --private-key="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
|
|
||||||
volumes:
|
|
||||||
- ${PATH_TO_CONTRACT_REPOS}/status-network-token-v2:/usr/local/bin/status-network-token-v2
|
|
||||||
|
|
||||||
deploy-communities-contracts:
|
|
||||||
environment:
|
|
||||||
# values arn't used, but env vars are required
|
|
||||||
- API_KEY_ETHERSCAN=""
|
|
||||||
- API_KEY_ARBISCAN=""
|
|
||||||
- API_KEY_OPTIMISTIC_ETHERSCAN=""
|
|
||||||
depends_on:
|
|
||||||
- anvil
|
|
||||||
- deploy-sntv2
|
|
||||||
image: ghcr.io/foundry-rs/foundry:latest
|
|
||||||
platform: linux/amd64
|
|
||||||
working_dir: /usr/local/bin/communities-contracts
|
|
||||||
command:
|
|
||||||
- forge clean && forge build && forge script script/DeployContracts.s.sol --broadcast --fork-url http://anvil:8545 --private-key="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
|
|
||||||
volumes:
|
|
||||||
- ${PATH_TO_CONTRACT_REPOS}/communities-contracts:/usr/local/bin/communities-contracts
|
|
||||||
|
|
||||||
status-go:
|
|
||||||
build:
|
|
||||||
context: ../
|
|
||||||
dockerfile: _assets/build/Dockerfile
|
|
||||||
args:
|
|
||||||
build_tags: gowaku_no_rln
|
|
||||||
build_target: statusd
|
|
||||||
build_flags: -ldflags="-X github.com/status-im/status-go/params.Version= -X github.com/status-im/status-go/params.GitCommit=11f83780d -X github.com/status-im/status-go/params.IpfsGatewayURL=https://ipfs.status.im/ -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true"
|
|
||||||
ports:
|
|
||||||
- 3333:3333
|
|
||||||
- 8080:8080
|
|
||||||
- 30303:30303
|
|
||||||
- 30303:30303/udp
|
|
||||||
- 30304:30304/udp
|
|
||||||
entrypoint: ["statusd", "-c", "/static/configs/config.json", "--seed-phrase=test test test test test test test test test test test junk", "--password=Strong12345"]
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
git clone https://github.com/$GITHUB_ORG/$GITHUB_REPO
|
||||||
|
cd $GITHUB_REPO
|
||||||
|
git submodule deinit --force .
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
forge build
|
||||||
|
exec "$@"
|
Loading…
Reference in New Issue