Skip to content

Latest commit

 

History

History
117 lines (81 loc) · 3.6 KB

README.md

File metadata and controls

117 lines (81 loc) · 3.6 KB

End-to-end tests

Components

The E2E tests consist of the following components:

  1. Blockchain

We use a local, development chain of Polkadot. A Cumulus based parachain is added to it. The startup is orchestrated by Zombienet.

  1. Matrix server

A local instance of a Matrix server is used. We use a published docker image of Synapse.

  1. The faucet

The local code of the faucet is built and started as a docker container.

  1. The test cases

A number of Jest test cases cover the external API of the faucet and the matrix-based interaction.

Run the tests locally

  1. Prepare the blockchain executables

We need several executables - polkadot, polkadot-prepare-worker and polkadot-execute-worker for Polkadot relay chain, and polkadot-parachain for Cumulus based parachain. It is recommended to use released versions of those (as opposed to code from master)

Decide, where to put the binaries (replace <bin_path> with it, for all examples) and add it to PATH, so that zombienet will be able to find them:

export PATH="<bin_path>:$PATH"

Linux:

For example, to download a v1.8.0 release of polkadot and a corresponding version of a parachain:

cd <bin_path>
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-stable2407-1/polkadot
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-stable2407-1/polkadot-prepare-worker
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-stable2407-1/polkadot-execute-worker
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-stable2407-1/polkadot-parachain
chmod +x ./polkadot*

Apple Silicon Macs:

There are no pre-built binaries, so we need to build the binaries from source:

git clone https://github.com/paritytech/polkadot-sdk.git
git checkout polkadot-stable2407-1

cd polkadot-sdk/polkadot
cargo build --release --locked
cp ../target/release/polkadot <bin_path>/
cp ../target/release/polkadot-execute-worker <bin_path>/
cp ../target/release/polkadot-prepare-worker <bin_path>/

cd ../cumulus/polkadot-parachain
cargo build --release --locked
cp ../../target/release/polkadot-parachain <bin_path>/
  1. Run zombienet

First, make sure that the polkadot and polkadot-parachain are in PATH. If not, go back to step 1..

command -v polkadot || echo "No polkadot in PATH"
command -v polkadot-parachain || echo "No polkadot-parachain in PATH"

Next, in the root of this repository, start the Zombienet:

yarn e2e:zombienet

Verify that it's working correctly by opening the relaychain and parachain explorers, and by asserting that it responds to RPC requests:

# Relay chain
curl localhost:9933
# Expecting: Used HTTP Method is not allowed. POST or OPTIONS is required

# Parachain
curl localhost:9934
# Expecting: Used HTTP Method is not allowed. POST or OPTIONS is required
  1. Build the faucet
yarn build:docker
  1. Run the tests
yarn test:e2e

Logs of the application container will be avaiable at e2e/containter_logs/faucet-test-app.log Logs of matrix container will be avaiable at e2e/containter_logs/faucet-test-matrix.log Logs of zombienet nodes will be available at e2e/zombienet_logs/

The whole suite of tests can take tens of seconds, because it depends on the blockchain to mine blocks and execute the XCM teleportation process.