Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Make zombienet tests native friendly #6588

Merged
merged 7 commits into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
37 changes: 37 additions & 0 deletions zombienet_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,43 @@ _The content of this directory is meant to be used by Parity's private CI/CD inf
* [zombienet repo](https://github.com/paritytech/zombienet)
* [zombienet book](https://paritytech.github.io/zombienet/)

## Running tests locally

To run any test locally use the native provider (`zombienet test -p native ...`) and prepare a directory containing all required polkadot/cumulus binaries. They are:

* adder-collator -> polkadot/target/testnet/adder-collator
* malus -> polkadot/target/testnet/malus
* polkadot -> polkadot/target/testnet/polkadot
* polkadot-collator -> cumulus/target/release/polkadot-parachain
* undying-collator -> polkadot/target/testnet/undying-collator

To build them use:
* adder-collator -> `cargo build --profile testnet -p test-parachain-adder-collator`
* undying-collator -> `cargo build --profile testnet -p test-parachain-undying-collator`
* malus -> cargo build --profile testnet -p polkadot-test-malus
* polkadot (in polkadot repo) and polkadot-collator (in cumulus repo) -> `cargo build --profile testnet`

One solution is to have a directory with symlinks to the corresponding binaries in your source tree. E.g.:
```
$ ls -l
total 24
lrwxrwxrwx. 1 ceco ceco 53 Jan 19 15:03 adder-collator -> /home/ceco/src/polkadot/target/testnet/adder-collator
-rw-r--r--. 1 ceco ceco 221 Jan 18 16:35 build_cmds.txt
lrwxrwxrwx. 1 ceco ceco 44 Jan 18 16:47 malus -> /home/user/src/polkadot/target/testnet/malus
lrwxrwxrwx. 1 ceco ceco 47 Jan 18 11:33 polkadot -> /home/user/src/polkadot/target/testnet/polkadot
lrwxrwxrwx. 1 ceco ceco 56 Jan 19 15:53 polkadot-collator -> /home/user/src/cumulus/target/release/polkadot-parachain
lrwxrwxrwx. 1 ceco ceco 55 Jan 18 13:58 undying-collator -> /home/user/src/polkadot/target/testnet/undying-collator
```

Then when you execute a test you set PATH as `PATH=/your/zombienet/binaries/dir:$PATH`. It's important to put your dir at the beginning of PATH otherwise zombienet might pick another binary.

Example:

The directory with the zombienet binaries is `/home/user/zombienet_bins/`. You can run a test locally by executing:
```
PATH=/home/user/zombienet_bins:$PATH zombienet test -p native 0001-parachains-pvf.zndsl
```

## Questions / permissions

Ping in element Javier (@javier:matrix.parity.io) to ask questions or grant permission to run the test from your local setup.
1 change: 1 addition & 0 deletions zombienet_tests/functional/0001-parachains-pvf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ timeout = 1000

[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "polkadot"
chain = "rococo-local"
chain_spec_command = "polkadot build-spec --chain rococo-local --disable-default-bootnode"

Expand Down
6 changes: 3 additions & 3 deletions zombienet_tests/functional/0001-parachains-pvf.zndsl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ eve: reports histogram polkadot_pvf_preparation_time has at least 1 samples in b
one: reports histogram polkadot_pvf_preparation_time has at least 1 samples in buckets ["0.1", "0.5", "1", "2", "3", "10"] within 10 seconds
two: reports histogram polkadot_pvf_preparation_time has at least 1 samples in buckets ["0.1", "0.5", "1", "2", "3", "10"] within 10 seconds

# Check all buckets >= 20.
# Check all buckets >= 20.
alice: reports histogram polkadot_pvf_preparation_time has 0 samples in buckets ["20", "30", "60", "180", "+Inf"] within 10 seconds
bob: reports histogram polkadot_pvf_preparation_time has 0 samples in buckets ["20", "30", "60", "180", "+Inf"] within 10 seconds
charlie: reports histogram polkadot_pvf_preparation_time has 0 samples in buckets ["20", "30", "60", "180", "+Inf"] within 10 seconds
Expand All @@ -78,8 +78,8 @@ two: reports histogram polkadot_pvf_preparation_time has 0 samples in buckets ["
# APPROVAL_EXECUTION_TIMEOUT(6s). Currently these are not differentiated by metrics
# because the metrics are defined in `polkadot-node-core-pvf` which is a level below
# the relevant subsystems.
# That being said, we will take the simplifying assumption of testing only the
# 2s timeout.
# That being said, we will take the simplifying assumption of testing only the
# 2s timeout.
# We do this check by ensuring all executions fall into bucket le="2" or lower.
# First, check if we have at least 1 sample, but we should have many more.
alice: reports histogram polkadot_pvf_execution_time has at least 1 samples in buckets ["0.1", "0.5", "1", "2"] within 10 seconds
Expand Down
2 changes: 1 addition & 1 deletion zombienet_tests/functional/0003-beefy-and-mmr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ timeout = 1000
[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
chain = "rococo-local"
command = "polkadot"
default_command = "polkadot"

[[relaychain.node_groups]]
name = "validator"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ requests = { memory = "2G", cpu = "1" }
command = "malus suggest-garbage-candidate"
args = ["-lparachain=debug,MALUS=trace"]
count = 1

{% for id in range(2000,2003) %}
[[parachains]]
id = {{id}}
Expand Down
2 changes: 1 addition & 1 deletion zombienet_tests/misc/0001-paritydb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ requests = { memory = "2G", cpu = "1" }
name = "validator"
count = 10
args = ["-lparachain=debug", "--db=paritydb"]

{% for id in range(2000,2010) %}
[[parachains]]
id = {{id}}
Expand Down
1 change: 1 addition & 0 deletions zombienet_tests/misc/0002-upgrade-node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ timeout = 1000

[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "polkadot"
chain = "rococo-local"


Expand Down
4 changes: 2 additions & 2 deletions zombienet_tests/smoke/0001-parachains-smoke-test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ timeout = 1000
[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
chain = "rococo-local"
command = "polkadot"
default_command = "polkadot"

[[relaychain.nodes]]
name = "alice"
Expand All @@ -21,7 +21,7 @@ addToGenesis = false
[parachains.collator]
name = "collator01"
image = "{{COL_IMAGE}}"
command = "/usr/local/bin/adder-collator"
command = "adder-collator"
args = [ "-lruntime=debug,parachain=trace" ]

[types.Header]
Expand Down
4 changes: 2 additions & 2 deletions zombienet_tests/smoke/0002-parachains-upgrade-smoke-test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bootnode = true
[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
chain = "rococo-local"
command = "polkadot"
default_command = "polkadot"

[[relaychain.nodes]]
name = "alice"
Expand All @@ -31,7 +31,7 @@ cumulus_based = true
[parachains.collator]
name = "collator01"
image = "{{COL_IMAGE}}"
command = "polkadot-collator"
command = "polkadot-collator" # Should become `polkadot-parachain`

[[parachains.collator.env]]
name = "RUST_LOG"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ timeout = 1000
[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
chain = "rococo-local"
command = "polkadot"
default_command = "polkadot"

[[relaychain.nodes]]
name = "alice"
Expand All @@ -21,4 +21,3 @@ command = "polkadot"
[[relaychain.nodes]]
name = "dave"
args = [ "-lruntime=debug,parachain=trace" ]