Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zombienet smoke test #1282

Merged
merged 6 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Rust",
"image": "mcr.microsoft.com/devcontainers/rust:latest",
"runArgs": ["--platform=linux/amd64"]
}
36 changes: 34 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ jobs:
asset_name: evm-tracing-artifacts-${{ github.ref_name }}.tar.gz
asset_content_type: application/gzip

chain-sync:
chain-sync-smoke:
needs: native-linux
runs-on: ubuntu-latest
strategy:
Expand All @@ -556,4 +556,36 @@ jobs:
- name: Sync chain ${{ matrix.chain }}
run: |
chmod +x target/release/astar-collator
./scripts/sync.sh ${{ matrix.chain }}
./scripts/sync-smoke.sh ${{ matrix.chain }}

zombienet-smoke:
needs: native-linux
runs-on: ubuntu-latest
strategy:
matrix:
chain: [ "astar-dev", "shiden-dev", "shibuya-dev" ]

steps:
- name: Checkout the source code
uses: actions/checkout@v4

- name: Download pre-built collator binary
uses: actions/download-artifact@v3
with:
name: astar-ubuntu-latest-x86_64
path: target/release

- name: Setup
run: |
chmod +x target/release/astar-collator
mv target/release/astar-collator third-party/zombienet

- name: Setup zombienet
working-directory: third-party/zombienet
run: ./setup.sh

- name: ${{ matrix.chain }} build blocks
working-directory: third-party/zombienet
env:
CHAIN: ${{ matrix.chain }}
run: zombienet -p native test smoke.zndsl
11 changes: 6 additions & 5 deletions scripts/sync.sh → scripts/sync-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ chain="$@"
# run node
./target/release/astar-collator --chain $chain --no-telemetry --no-prometheus --tmp -- --no-telemetry --no-prometheus & CHAIN_PID=$!

printf "Waiting for RPC to be ready"
trap "kill $CHAIN_PID" EXIT

echo "Waiting for RPC to be ready"
attempts=12 # 1 minutes
until nc -z localhost 9944; do
attempts=$((attempts - 1))
Expand All @@ -19,10 +21,11 @@ until nc -z localhost 9944; do
sleep 5
done

printf "Waiting for 30 seconds to sync at least 1000 blocks"
echo "Waiting for 30 seconds to sync at least 1000 blocks"
sleep 30

number=$(curl --location http://localhost:9944 \
number=$(curl --silent \
--location http://localhost:9944 \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
Expand All @@ -35,5 +38,3 @@ if [ "$number" -lt 1000 ]; then
echo "ERROR: Chain failed to sync 1000 blocks in 30 seconds"
exit 1
fi

kill $CHAIN_PID
34 changes: 34 additions & 0 deletions third-party/zombienet/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -e

if [ $(arch) != "x86_64" ]
then
echo "Runs only on x86_64 architecture"
exit 1
fi

if ! command -v ./astar-collator &> /dev/null
then
echo "No executable astar-collator binary in zombienet directory"
exit 1
fi

ZOMBINET_VERSION=v1.3.106

if ! command -v zombienet &> /dev/null
then
echo "Install zombienet $ZOMBINET_VERSION"
mkdir -p $HOME/.local/bin
wget -q -O $HOME/.local/bin/zombienet https://github.com/paritytech/zombienet/releases/download/$ZOMBINET_VERSION/zombienet-linux-x64
chmod a+x $HOME/.local/bin/zombienet
PATH=$HOME/.local/bin:$PATH
zombienet version
fi

echo "Pull polkadot binaries"
zombienet setup polkadot -y & SETUP_PID=$!
while ps $SETUP_PID > /dev/null ; do
sleep 1
done
chmod +x polkadot polkadot-execute-worker polkadot-prepare-worker
39 changes: 39 additions & 0 deletions third-party/zombienet/smoke.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[settings]
timeout = 1000

# Used to start 4 validator nodes and 2 collator nodes for a single parachain.

[relaychain]
default_command = "./polkadot"
chain = "rococo-local"

[[relaychain.nodes]]
name = "alice"
validator = true

[[relaychain.nodes]]
name = "bob"
validator = true

[[relaychain.nodes]]
name = "charlie"
validator = true

[[relaychain.nodes]]
name = "dave"
validator = true

[[parachains]]
# Right now this has to be 2000 but soon we might be able to use arbitrary para-id
id = 2000
chain = "{{CHAIN}}"
cumulus_based = true

[[parachains.collators]]
name = "collator1"
command = "./astar-collator"
ws_port=9944

[[parachains.collators]]
name = "collator2"
command = "./astar-collator"
11 changes: 11 additions & 0 deletions third-party/zombienet/smoke.zndsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Description: Parachain build blocks
Network: ./smoke.toml
Creds: config

alice: is up
collator1: is up
collator2: is up

## test the block height
collator1: reports block height is greater than 5 within 200 seconds
collator2: reports block height is greater than 5 within 200 seconds
Loading