Spins up and tests Omni devnets in Docker Compose based on a testnet manifest. To run the CI testnet:
# In repo root
# Install the e2e app
go install github.com/omni-network/omni/e2e
# Build docker image of the code to test.
make build-docker
# Run one of the "manifests" in manifests/ directory: e2e -f <manifest>
e2e -f e2e/manifests/devnet0.tomlThis creates and runs a testnet named single under e2e/runs/single/.
Please refer to the cometBFT E2E test framework for more details.
In order to perform any action on a network (deploy/test/show logs), the following process is followed to create a network Definition:
- A network is initially declared in a
manifestfile, see manifests/ folder. It defines the desired network topology. See thee2e/types#Manifesttype for details. - Then the infrastructure provider (only
docker composesupported at the moment) subsequently generates thee2e/types#InfrastructureDatafrom the manifest. This defines the instance IPs and ports of everything we will deploy. - Subsequently, we generate a
Testnetstruct which is basically contains all the configuration/keys/peers/images/files/folders required to deploy a network. Seee2e/types#Testnetfor details. - We then instantiate a
netman.Managerwhich is responsible for deploying portals. It takes aTestnetstruct as input. - Finally, we instantiate new
InfrastructureProviderwhich can deploy the network. It takes aTestnetstruct andInfrastructureDataas input.
These objects are then wrapped in a e2e/app#Definition that can be used to perform any action on a network.
The e2e test has the following stages, which can also be executed explicitly by running e2e -f <manifest> <stage>:
-
setup: generates configuration files. -
start: starts Docker containers. -
wait: waits for a few blocks to be produced, and for all nodes to catch up to it. -
stop: stops Docker containers. -
cleanup: removes configuration files and Docker containers/networks.
Auxiliary commands:
-
logs: outputs all node logs. -
tail: tails (follows) node logs until canceled.
MacBook E2E test fails to start docker container If you are experiencing an issue running the e2e tests and the error output looks like this:
Error response from daemon: no match for platform in manifest
This error is known to happen on a freshly installed MacBook, we are investigating the underlying issue, but meanwhile, there is a workaround:
- Clean all the build images
docker system prune -a -f --volumes - Set the platform env:
export DOCKER_DEFAULT_PLATFORM=linux/amd64 - Rerun docker build:
make build-docker - Run tests again:
make e2e-cior any other tests using the e2e command.
Please let the team know if you experienced the above issue.
Failure to start SVM container
If the e2e tests fail to run with an error such as the following:
ERRO !! Fatal error occurred, app died !! err="svm init: request airdrop for role account: rpc call requestAirdrop() on http://localhost:8899: Post \"http://localhost:8899\": dial tcp [::1]:8899: connect: connection refused"Check the SVM container logs for an error such as: Incompatible CPU detected: missing AVX support.
This issue typically happens when using an unsupported virtual machine. To solve it:
- Go to Docker Desktop's settings > General > Virtual Machine Options
- Select the Docker VMM option and restart Docker
- Rerun docker build:
make build-docker