### Example: Output of ZombieNet Binary Setup Source: https://paritytech.github.io/zombienet/intro.html/cli/setup Shows the typical console output when running the `zombienet setup` command to download binaries. It includes download progress, permission assignment, and the final instruction to update the PATH variable. ```Shell Setup will start to download binaries: - polkadot Approx. size 113 MB - polkadot-parachain Approx. size 120 MB Total approx. size: 233 MB Do you want to continue? (y/n)y Start download... -> downloading [========================================] 100% 0.0s Binary "polkadot-parachain" downloaded Giving permissions to "polkadot-parachain" -> downloading [========================================] 100% 0.0s Binary "polkadot" downloaded Giving permissions to "polkadot" Please add the dir to your $PATH by running the command: export PATH=/home//zombienet/dist:$PATH ``` -------------------------------- ### Example Zombienet Setup Command for Polkadot Binaries Source: https://paritytech.github.io/zombienet/intro.html/print Demonstrates how to use the `zombienet setup` command to download and prepare both 'polkadot' and 'polkadot-parachain' binaries for use with Zombienet. ```Shell ➜ zombienet setup polkadot polkadot-parachain ``` -------------------------------- ### Example: Setup Polkadot and Parachain Binaries Source: https://paritytech.github.io/zombienet/intro.html/cli/setup Illustrates a practical usage of the `zombienet setup` command to download both 'polkadot' and 'polkadot-parachain' binaries. This command is typically run on Linux systems. ```Shell ➜ zombienet setup polkadot polkadot-parachain ``` -------------------------------- ### Install Zombienet Dependencies and Setup Environment Source: https://paritytech.github.io/zombienet/intro.html/print This command navigates to the Zombienet JavaScript directory, installs necessary npm dependencies, and then runs the `zombie` setup script. The `` placeholder indicates that specific Polkadot-related binaries can be specified for download and installation, preparing the environment for Zombienet operations. ```Shell cd zombinet/javascript npm i && npm run zombie -- setup ``` -------------------------------- ### Zombienet Setup Command Output Example Source: https://paritytech.github.io/zombienet/intro.html/print Shows a typical output when running the `zombienet setup` command to download Polkadot binaries. It includes progress indicators, confirmation prompts, download sizes, and the final instruction to update the PATH variable. ```Shell Setup will start to download binaries: - polkadot Approx. size 113 MB - polkadot-parachain Approx. size 120 MB Total approx. size: 233 MB Do you want to continue? (y/n)y Start download... -> downloading [========================================] 100% 0.0s Binary "polkadot-parachain" downloaded Giving permissions to "polkadot-parachain" -> downloading [========================================] 100% 0.0s Binary "polkadot" downloaded Giving permissions to "polkadot" Please add the dir to your $PATH by running the command: export PATH=/home//zombienet/dist:$PATH ``` -------------------------------- ### Setup ZombieNet Development Environment with Binaries Source: https://paritytech.github.io/zombienet/intro.html/development Changes directory, installs dependencies, and runs the ZombieNet setup script to download and prepare specified binaries for a development environment. The `` placeholder should be replaced with actual binary names. ```bash cd zombinet/javascript npm i && npm run zombie -- setup ``` -------------------------------- ### Install and Verify ZombieNet via NPM Source: https://paritytech.github.io/zombienet/intro.html/install This snippet demonstrates how to install the latest version of the ZombieNet command-line interface globally using Node.js Package Manager (NPM) and then verify its successful installation by accessing the help command. ```NPM npm i @zombienet/cli@latest -g ``` ```Shell zombienet help ``` -------------------------------- ### Setup Zombienet with Specific Polkadot Binaries Source: https://paritytech.github.io/zombienet/intro.html/print An example demonstrating how to use the Zombienet setup script to download and prepare `polkadot` and `polkadot-parachain` binaries. This ensures the required executables are available for Zombienet's operation, streamlining the setup process for specific network configurations. ```Shell cd zombinet/javascript npm i && npm run zombie -- setup polkadot polkadot-parachain ``` -------------------------------- ### Setup ZombieNet with Polkadot and Parachain Binaries Source: https://paritytech.github.io/zombienet/intro.html/development Installs ZombieNet dependencies and uses the setup command to download and configure `polkadot` and `polkadot-parachain` binaries, preparing them for local development and testing. ```bash cd zombinet/javascript npm i && npm run zombie -- setup polkadot polkadot-parachain ``` -------------------------------- ### Install and Configure ZombieNet Binary on macOS Source: https://paritytech.github.io/zombienet/intro.html/install This snippet provides the necessary shell commands to make a downloaded ZombieNet binary executable, remove macOS quarantine attributes, and verify its installation on macOS systems. ```Shell chmod +x ./zombienet ``` ```Shell xattr -d com.apple.quarantine ./zombienet ``` ```Shell ./zombienet help ``` -------------------------------- ### Zombienet Setup Command Usage and Arguments Source: https://paritytech.github.io/zombienet/intro.html/print Explains the `zombienet setup` command, its purpose for preparing the development environment, and the `binaries` argument for specifying which Polkadot binaries to download. It notes that downloaded binaries are placed in the current directory and given executable permissions. ```Shell ❯ zombienet setup Setup is meant for downloading and making everything ready for dev environment of ZombieNet; You can use the following arguments: binaries the binaries that you want to be downloaded, provided in a row without any separators; They are downloaded in current directory and appropriate executable permissions are assigned. Possible options: 'polkadot', 'polkadot-parachain' > zombienet setup polkadot polkadot-parachain ``` -------------------------------- ### Run ZombieNet Using Nix Flakes Source: https://paritytech.github.io/zombienet/intro.html/install This snippet shows how to execute ZombieNet directly from its GitHub repository using Nix flakes, allowing to run either the latest main branch version or a specific tagged release without a local installation. ```Nix nix run github:paritytech/zombienet -- spawn config.toml ``` ```Nix nix run github:paritytech/zombienet/v1.3.40 -- spawn config.toml ``` -------------------------------- ### Run Zombienet Test for Small Network Source: https://paritytech.github.io/zombienet/intro.html/guide Command to execute a Zombienet test scenario defined in `0001-small-network.zndsl` using the Kubernetes provider. This command initiates the test and generates reports. ```bash ./zombienet-linux -p kubernetes test examples/0001-small-network.zndsl ``` -------------------------------- ### Zombienet Test File Header for Small Network Source: https://paritytech.github.io/zombienet/intro.html/guide Header of a Zombienet test file (.zndsl) for the small network example, defining its description, the network configuration file it uses, and credentials for the test. ```zndsl Description: Small Network test Network: ./0001-small-network.toml Creds: config ``` -------------------------------- ### ZombieNet Setup Command Overview Source: https://paritytech.github.io/zombienet/intro.html/cli/setup Details the `zombienet setup` command, which automates the download and preparation of ZombieNet development environment binaries. It explains available arguments for specifying which binaries to download, such as 'polkadot' and 'polkadot-parachain'. ```Shell ❯ zombienet setup Setup is meant for downloading and making everything ready for dev environment of ZombieNet; You can use the following arguments: binaries the binaries that you want to be downloaded, provided in a row without any separators; They are downloaded in current directory and appropriate executable permissions are assigned. Possible options: 'polkadot', 'polkadot-parachain' > zombienet setup polkadot polkadot-parachain ``` -------------------------------- ### Zombienet JavaScript Project Installation Source: https://paritytech.github.io/zombienet/intro.html/print Instructions for setting up the Zombienet JavaScript project, including cloning the repository and installing dependencies using npm. ```bash cd zombienet/javascript npm i && npm run build ``` -------------------------------- ### Spawn Zombienet Network with Kubernetes Provider Source: https://paritytech.github.io/zombienet/intro.html/guide Commands to deploy a defined Zombienet network using the `spawn` command. The first command explicitly sets Kubernetes as the provider, while the second uses the default provider (which is Kubernetes). ```bash ./zombienet-linux -p kubernetes spawn examples/0001-small-network.toml ``` ```bash ./zombienet-linux spawn examples/0001-small-network.toml ``` -------------------------------- ### Run Zombienet Test with Native Provider Source: https://paritytech.github.io/zombienet/intro.html/guide Commands to execute Zombienet tests using different network configuration file types (JSON, YAML, TOML) with the native provider. These commands demonstrate how to initiate a test run for a specific Zombienet DSL file. ```bash ./zombienet-linux -p native test examples/0000-test-json-config-small-network.zndsl ``` ```bash ./zombienet-linux -p native test examples/0000-test-yaml-config-small-network.zndsl ``` ```bash ./zombienet-linux -p native test examples/0000-test-toml-config-small-network.zndsl ``` -------------------------------- ### Install ZombieNet JavaScript Dependencies Source: https://paritytech.github.io/zombienet/intro.html/development Navigates to the ZombieNet JavaScript directory, installs project dependencies using npm, and then builds the project for local use. ```bash cd zombienet/javascript npm i && npm run build ``` -------------------------------- ### Execute Zombienet Tests with Concurrency Source: https://paritytech.github.io/zombienet/intro.html/guide This command executes Zombienet tests defined in a DSL file. It specifies the Kubernetes provider and a concurrency limit of 5, allowing for parallel execution of tests and faster reporting. ```Shell ./zombienet-linux -p kubernetes -c 5 test examples/0003-big-network.zndsl ``` -------------------------------- ### Install and Verify ZombieNet CLI via NPM Source: https://paritytech.github.io/zombienet/intro.html/print Instructions to install the latest ZombieNet CLI globally using npm, which requires Node.js, and then verify the successful installation by accessing the zombienet help command. ```npm npm i @zombienet/cli@latest -g ``` ```bash zombienet help ``` -------------------------------- ### Spawn Zombienet Network with Environment Variables Source: https://paritytech.github.io/zombienet/intro.html/guide Command to spawn a Zombienet network defined in `0002-small-network-env-vars.toml`. This command utilizes the previously set environment variables to resolve image paths, allowing for dynamic network deployment. ```bash ./zombienet-linux -p kubernetes spawn examples/0002-small-network-env-vars.toml ``` -------------------------------- ### Run Zombienet Test with Kubernetes Provider Source: https://paritytech.github.io/zombienet/intro.html/print Demonstrates how to execute a Zombienet test using the Kubernetes provider and a specific configuration file. This command initiates the network setup and test execution as defined in the Zombienet DSL file. ```bash ./zombienet-linux -p kubernetes -c 5 test examples/0003-big-network.zndsl ``` -------------------------------- ### Native Node Log Monitoring with tail Source: https://paritytech.github.io/zombienet/intro.html/guide For nodes running with the native provider, Zombienet suggests using this command to follow the logs of a specific node. It tails the designated log file, providing real-time updates. ```Shell tail -f /var/folders/rz/1cyx7hfj31qgb98d8_cg7jwh0000gn/T/zombie-22eaa5159aca78ff41e0249c3931b472_-91504-Ea3rT0YgKH2Y/alice.log ``` -------------------------------- ### Run and Shell into ZombieNet with Nix Source: https://paritytech.github.io/zombienet/intro.html/print Examples demonstrating how to run ZombieNet using Nix flakes, specifying either the latest version from the main branch or a particular release tag, and how to add the ZombieNet binary to the current shell's PATH for temporary access. ```nix nix run github:paritytech/zombienet -- spawn config.toml ``` ```nix nix run github:paritytech/zombienet/v1.3.40 -- spawn config.toml ``` ```nix nix shell github:paritytech/zombienet/v1.3.40 ``` -------------------------------- ### Zombienet Network Configuration with Environment Variables Source: https://paritytech.github.io/zombienet/intro.html/guide A TOML configuration file for Zombienet defining a relay chain and a parachain. It demonstrates the use of Nunjucks templating (`{{VAR_NAME}}`) for dynamic image paths via environment variables, allowing for flexible deployment configurations. ```toml [relaychain] default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" default_command = "polkadot" default_args = [ "-lparachain=debug" ] chain = "rococo-local" [[relaychain.nodes]] name = "alice" validator = true [[relaychain.nodes]] name = "bob" validator = true image= "{{ZOMBIENET_ALTERNATIVE_TEST_IMAGE}}" [[parachains]] id = 100 [parachains.collator] name = "collator01" image = "{{ZOMBIENET_COL_IMAGE}}" command = "polkadot-parachain" ``` -------------------------------- ### Set Zombienet Environment Variables Source: https://paritytech.github.io/zombienet/intro.html/guide Commands to set environment variables that are consumed by Zombienet configurations using Nunjucks templating. These variables dynamically specify Docker image paths for different components of the network. ```bash export ZOMBIENET_INTEGRATION_TEST_IMAGE=docker.io/parity/polkadot:latest export ZOMBIENET_ALTERNATIVE_TEST_IMAGE=docker.io/parity/polkadot:v0.9.37 export ZOMBIENET_COL_IMAGE=docker.io/parity/polkadot-parachain:latest ``` -------------------------------- ### Zombienet Convert Command Example Source: https://paritytech.github.io/zombienet/intro.html/print An example demonstrating how to use the `zombienet convert` command to transform a Polkadot Launch configuration file named `my-project-config.json` into a Zombienet-compatible format. ```Shell zombienet convert my-project-config.json ``` -------------------------------- ### Run Zombienet Tests with Kubernetes Source: https://paritytech.github.io/zombienet/intro.html/print Command to execute Zombienet tests, showing both launching output and test reports, specifically targeting a small network example using the Kubernetes provisioner. ```bash ./zombienet-linux -p kubernetes test examples/0001-small-network.zndsl ``` -------------------------------- ### Spawn Zombienet Network with Concurrency Source: https://paritytech.github.io/zombienet/intro.html/guide This command spawns a Zombienet network defined in a TOML configuration file. It uses the Kubernetes provider and a concurrency limit of 5 to deploy nodes in batches, significantly speeding up the network launch process. ```Shell ./zombienet-linux -p kubernetes -c 5 spawn examples/0003-big-network.toml ``` -------------------------------- ### Zombienet CLI Command Reference Source: https://paritytech.github.io/zombienet/intro.html/print Comprehensive reference for the Zombienet command-line interface, detailing available options, main commands (spawn, test, setup, version), and debug environment variables. This output is typically obtained by running the Zombienet executable without arguments or with the '--help' flag. ```APIDOC ./zombienet-macos Usage: zombienet [options] [command] Options: -c, --spawn-concurrency Number of concurrent spawning process to launch, default is 1 -p, --provider Override provider to use (choices: "podman","kubernetes", "native", default: kubernetes) -d, --dir Directory path for placing the network files instead of random temp one (e.g. -d /home/user/my-zombienet) -l, --logType " Type of logging on the console - defaults to 'table'" (choices: "table", "text", "silent") -f, --force Force override all prompt commands -m, --monitor Start as monitor, do not auto cleanup network -h, --help display help for command Commands: spawn [creds] Spawn the network defined in the config test [runningNetworkSpec] Run tests on the network defined setup Setup is meant for downloading and making dev environment of ZombieNet ready version Prints zombienet version help [command] display help for command Debug: The debug/verbose output is managed by the DEBUG environment variable, you can enable/disable specific debugging namespaces setting an space or comma-delimited names. $ e.g $ DEBUG=zombie, zombie::paras zombienet spawn example/0001-example.toml The available namespaces are: zombie zombie::chain zombie::cmdGenerator zombie::config zombie::helper zombie::js zombie::kube zombie::metrics zombie::native zombie::network zombie::paras zombie::podman zombie::spawner zombie::substrateCliArgsVersion zombie::test NOTE: wildcard (e.g.'zombie*') are supported, for advance use check https://www.npmjs.com/package/debug#wildcards ``` -------------------------------- ### Podman Container Log Monitoring Source: https://paritytech.github.io/zombienet/intro.html/guide This command, provided by Zombienet, enables users to follow the real-time logs of a specific container managed by Podman. The `-f` flag ensures continuous output of new log entries. ```Shell podman logs -f alice_pod-alice ``` -------------------------------- ### Configure and Verify ZombieNet MacOS Binary Source: https://paritytech.github.io/zombienet/intro.html/print Commands to make the downloaded ZombieNet macOS binary executable, remove it from quarantine to allow execution, and verify its installation by running the help command. ```bash chmod +x ./zombienet ``` ```bash xattr -d com.apple.quarantine ./zombienet ``` ```bash ./zombienet help ``` -------------------------------- ### Zombienet Test Assertions Source: https://paritytech.github.io/zombienet/intro.html/guide Examples of Zombienet test assertions for various aspects like node metrics, log content, system events, and parachain status. These assertions are used to verify the behavior of the network during a test run. ```Zombienet Test DSL # metrics alice: reports node_roles is 4 alice: reports sub_libp2p_is_major_syncing is 0 # histogram alice: reports histogram polkadot_pvf_execution_time has at least 2 samples in buckets ["0.1", "0.25", "0.5", "+Inf"] within 100 seconds # logs bob: log line matches glob "*rted #1*" within 10 seconds bob: log line matches "Imported #[0-9]+" within 10 seconds bob: count of log lines matching "Error" is 0 within 10 seconds # system events bob: system event contains "A candidate was included" within 20 seconds alice: system event matches glob "*was backed*" within 10 seconds #parachain tests alice: parachain 100 is registered within 225 seconds alice: parachain 100 block height is at least 10 within 200 seconds ``` -------------------------------- ### ZombieNet Convert Command Practical Example Source: https://paritytech.github.io/zombienet/intro.html/cli/convert Provides a concrete example of using the `zombienet convert` command to transform a `my-project-config.json` file, which is a Polkadot Launch configuration, into the ZombieNet format. This demonstrates a typical conversion scenario. ```Shell zombienet convert my-project-config.json ``` -------------------------------- ### Zombienet Command Line Interface (CLI) Reference Source: https://paritytech.github.io/zombienet/intro.html/print This section provides a comprehensive reference for the `zombienet` CLI tool. It details the available options for configuring Zombienet's behavior, such as concurrency, provider selection, logging, and output directory. It also lists all primary commands like `spawn`, `test`, `setup`, `convert`, and `version`, along with their basic usage and purpose. ```APIDOC Usage: zombienet [options] [command] Options: -c, --spawn-concurrency Number of concurrent spawning process to launch, default is 1 -p, --provider Override provider to use (choices: "podman", "kubernetes", "native") -l, --logType Type of logging - defaults to 'table' (choices: "table", "text", "silent") -d, --dir Directory path for placing the network files instead of random temp one (e.g. -d /home/user/my-zombienet) -f, --force Force override all prompt commands -h, --help display help for command Commands: spawn [options] [creds] Spawn the network defined in the config test [runningNetworkSpec] Run tests on the network defined setup [options] Setup is meant for downloading and making dev environment of ZombieNet ready convert Convert is meant for transforming a (now deprecated) polkadot-launch configuration to zombienet configuration version Prints zombienet version help [command] display help for command ``` -------------------------------- ### Add ZombieNet Binaries to System PATH Source: https://paritytech.github.io/zombienet/intro.html/cli/setup Provides the command necessary to add the directory containing the downloaded ZombieNet binaries to the system's PATH environment variable. This allows the binaries to be executed from any location in the terminal. ```Shell Please add the dir to your $PATH by running the command: export PATH=/home///dist:$PATH ``` -------------------------------- ### Add Zombienet Binaries Directory to PATH Source: https://paritytech.github.io/zombienet/intro.html/print Provides an example command to add the directory containing the downloaded Zombienet binaries to the system's PATH environment variable, making them accessible from any directory. ```Shell Please add the dir to your $PATH by running the command: export PATH=/home///dist:$PATH ``` -------------------------------- ### Zombienet Test File Network Configuration Source: https://paritytech.github.io/zombienet/intro.html/guide Illustrates how a Zombienet test file (.zndsl) specifies the network configuration file it will use for testing. This snippet shows a reference to a JSON configuration. ```zndsl Network: ./0000-test-config-small-network.json ``` -------------------------------- ### Add ZombieNet to Current Shell PATH with Nix Source: https://paritytech.github.io/zombienet/intro.html/install This snippet demonstrates how to temporarily add a specific version of the ZombieNet binary to the current shell's PATH using Nix, making it directly callable for the duration of the session. ```Nix nix shell github:paritytech/zombienet/v1.3.40 ``` -------------------------------- ### Kubernetes Node Log Monitoring with kubectl Source: https://paritytech.github.io/zombienet/intro.html/guide This command, suggested by Zombienet, allows users to follow the real-time logs of a specific node running in a Kubernetes cluster. The `-f` flag enables continuous streaming of new log entries. ```Shell kubectl logs -f a-0 ``` -------------------------------- ### Define a Small Zombienet Network with TOML Source: https://paritytech.github.io/zombienet/intro.html/guide TOML configuration for a Zombienet network, including a relay chain with two validators (Alice, Bob) and a parachain (ID 100) with a collator. Specifies default images, commands, and arguments for nodes within the network. ```toml [relaychain] default_image = "docker.io/parity/polkadot:latest" default_command = "polkadot" default_args = [ "-lparachain=debug" ] chain = "rococo-local" [[relaychain.nodes]] name = "alice" validator = true [[relaychain.nodes]] name = "bob" validator = true [[parachains]] id = 100 [parachains.collator] name = "collator01" image = "docker.io/parity/polkadot-parachain:latest" command = "polkadot-parachain" args = ["-lparachain=debug"] ``` -------------------------------- ### Podman Monitor Service URLs Source: https://paritytech.github.io/zombienet/intro.html/print Example output showing the URLs for Prometheus, Tempo, and Grafana services deployed by Zombienet when using the Podman provider. These services provide monitoring and visibility for the running network. ```Text Monitor: prometheus - url: http://127.0.0.1:34123 Monitor: tempo - url: http://127.0.0.1:34125 Monitor: grafana - url: http://127.0.0.1:41461 ``` -------------------------------- ### Enable Zombienet Debug Logs Source: https://paritytech.github.io/zombienet/intro.html/guide This command enables detailed debug logging for Zombienet by setting the `DEBUG` environment variable. It is particularly useful for troubleshooting issues during the network spawning and testing processes, providing verbose output for analysis. ```Shell DEBUG=zombie* ./zombienet-linux -p kubernetes -c 5 test examples/0003-big-network.zndsl ``` -------------------------------- ### ZombieNet Debug Logging Configuration Example Source: https://paritytech.github.io/zombienet/intro.html/cli/index Illustrates how to enable and configure verbose debugging output for ZombieNet using the `DEBUG` environment variable, allowing for selective logging based on specific internal namespaces. ```shell $ e.g $ DEBUG=zombie, zombie::paras zombienet spawn example/0001-example.toml ``` -------------------------------- ### Zombienet Feature Test DSL Example Source: https://paritytech.github.io/zombienet/intro.html/print This snippet provides an example of a Zombienet feature test definition. It specifies the network configuration to use and includes natural language-like assertions to verify node status, parachain registration, and block production within specified timeframes. ```Zombienet Test DSL Description: Simple Network Smoke Test Network: ./0001-small-network.toml Creds: config alice: is up bob: is up alice: parachain 100 is registered within 225 seconds alice: parachain 100 block height is at least 10 within 200 seconds ``` -------------------------------- ### Zombienet Configuration for Large Networks with Node and Collator Groups Source: https://paritytech.github.io/zombienet/intro.html/guide This configuration defines a large Zombienet network using `node_groups` and `collator_groups` to efficiently spawn multiple validators and collators. It sets default image and command for the relay chain and specifies group-specific overrides, allowing for scalable network definitions. ```Zombienet Config [relaychain] default_image = "docker.io/paritypr/polkadot:latest" default_command = "polkadot" default_args = [ "-lparachain=debug" ] chain = "rococo-local" [[relaychain.node_groups]] name = "a" args = [ "-lparachain=debug", "--database=paritydb-experimental" ] count = 5 [[relaychain.node_groups]] name = "b" count = 5 [[parachains]] id = 100 [[parachains.collator_groups]] count = 2 [parachains.collator_groups.collator] name = "collator" command = "polkadot-parachain" image = "docker.io/parity/polkadot-parachain:latest" ``` -------------------------------- ### Follow Node Logs in Native Provider Source: https://paritytech.github.io/zombienet/intro.html/print Provides an example of using `tail -f` to stream logs from a node's log file when Zombienet is running with the native provider. This method directly accesses the log file generated by the node process. ```bash tail -f /var/folders/rz/1cyx7hfj31qgb98d8_cg7jwh0000gn/T/zombie-22eaa5159aca78ff41e0249c3931b472_-91504-Ea3rT0YgKH2Y/alice.log ``` -------------------------------- ### Enable Zombienet Debug Logs Source: https://paritytech.github.io/zombienet/intro.html/print Shows how to enable detailed debug logging for Zombienet by setting the `DEBUG` environment variable before running a test. This provides verbose output that can be crucial for diagnosing issues during network setup and test execution. ```bash DEBUG=zombie* ./zombienet-linux -p kubernetes -c 5 test examples/0003-big-network.zndsl ``` -------------------------------- ### Add Zombienet Binaries Directory to System PATH Source: https://paritytech.github.io/zombienet/intro.html/print After Zombienet's setup script downloads binaries, it provides this command to update the user's system PATH environment variable. This makes the newly downloaded binaries accessible from any directory in the terminal without needing to specify their full path, simplifying command execution. ```Shell export PATH=/home///dist:$PATH ``` -------------------------------- ### Exporting Environment Variables and Spawning ZombieNet Source: https://paritytech.github.io/zombienet/intro.html/cli/env_vars This shell script demonstrates how to export the environment variables referenced in the ZombieNet configuration (e.g., `ZOMBIENET_INTEGRATION_TEST_IMAGE`, `COL_IMAGE`) before executing the `zombienet` spawn command. This allows for dynamic image paths and other configuration parameters to be injected into the network setup. ```Shell export ZOMBIENET_INTEGRATION_TEST_IMAGE=docker.io/paritypr/polkadot-debug:master export COL_IMAGE=docker.io/paritypr/colander:4131-ccd09bbf ./zombienet-macos spawn examples/0001-small-network.toml ``` -------------------------------- ### Define Minimal Zombienet Network Configuration (TOML) Source: https://paritytech.github.io/zombienet/intro.html/cli/spawn A TOML configuration example for Zombienet, defining a small ephemeral network. It includes settings for a timeout, a relay chain with two validator nodes (Alice and Bob), and a parachain with a collator node. This configuration specifies default images and chain details for the network components. ```toml [settings] timeout = 1000 [relaychain] default_image = "paritypr/polkadot-debug:master" chain = "rococo-local" [[relaychain.nodes]] name = "alice" [[relaychain.nodes]] name = "bob" [[parachains]] id = 100 [parachains.collator] name = "collator01" image = "paritypr/colander:4131-ccd09bbf" command = "adder-collator" ``` -------------------------------- ### ZombieNet Simple Network Smoke Test Assertion Example Source: https://paritytech.github.io/zombienet/intro.html/cli/testing This snippet illustrates a ZombieNet test definition for a simple network smoke test. It specifies the network configuration file and credentials, then defines a series of assertions. These assertions verify that both 'alice' and 'bob' nodes are operational, parachain 100 is registered within a specified time, and parachain 100 produces at least 10 blocks within 200 seconds. ```ZombieNet Test Definition Description: Simple Network Smoke Test Network: ./0001-small-network.toml Creds: config alice: is up bob: is up alice: parachain 100 is registered within 225 seconds alice: parachain 100 block height is at least 10 within 200 seconds ``` -------------------------------- ### Zombienet Test Definition for Big Network Assertions Source: https://paritytech.github.io/zombienet/intro.html/guide This Zombienet DSL snippet defines tests for a large network, asserting specific metrics on different node groups ('a' and 'b'). It demonstrates how to reference group names within test definitions to apply assertions across multiple nodes or collators belonging to a group. ```Zombienet DSL Description: Big Network test Network: ./0003-big-network.toml Creds: config # metrics a: reports node_roles is 4 b: reports sub_libp2p_is_major_syncing is 0 ``` -------------------------------- ### Zombienet Testing DSL Overview Source: https://paritytech.github.io/zombienet/intro.html/print An abstract overview of the Zombienet Testing DSL, highlighting its goal to simplify test creation using natural language-style assertions across various blockchain aspects like storage, metrics, logs, and API calls. ```APIDOC Testing DSL: - Abstract: - Goal: Provide a simple way to create tests using a defined set of assertions. - Assertions based on: - On chain storage - Metrics - Histograms - Logs - System events - Tracing - Custom api calls (through polkadot.js) - Commands - Style: Each abstraction expressed by sentences defined in a natural language style. - Test file (*.zndsl) includes: - Pre-defined header fields for suite information (e.g. network configuration, credentials location). ``` -------------------------------- ### Spawn Zombienet Network with Environment Variables Source: https://paritytech.github.io/zombienet/intro.html/print Command to launch a Zombienet network using a TOML configuration that relies on previously exported environment variables for image paths, utilizing the Kubernetes provisioner. ```bash ./zombienet-linux -p kubernetes spawn examples/0002-small-network-env-vars.toml ``` -------------------------------- ### Execute Zombienet Tests with Different Configuration Formats Source: https://paritytech.github.io/zombienet/intro.html/print These commands demonstrate how to run Zombienet tests using the native provider, specifying different network configuration files (JSON, YAML, TOML) via their respective ZNDSL test files. Each command executes a test against a specific configuration format. ```bash ./zombienet-linux -p native test examples/0000-test-json-config-small-network.zndsl ``` ```bash ./zombienet-linux -p native test examples/0000-test-yaml-config-small-network.zndsl ``` ```bash ./zombienet-linux -p native test examples/0000-test-toml-config-small-network.zndsl ``` -------------------------------- ### ZombieNet CLI Reference Source: https://paritytech.github.io/zombienet/intro.html/development Comprehensive reference for the ZombieNet command-line interface, detailing available options, global flags, and subcommands with their respective parameters and descriptions for managing network operations. ```APIDOC Usage: zombienet [options] [command] Options: -c, --spawn-concurrency Number of concurrent spawning process to launch, default is 1 -p, --provider Override provider to use (choices: "podman", "kubernetes", "native") -l, --logType Type of logging - defaults to 'table' (choices: "table", "text", "silent") -d, --dir Directory path for placing the network files instead of random temp one (e.g. -d /home/user/my-zombienet) -f, --force Force override all prompt commands -h, --help display help for command Commands: spawn [options] [creds] Spawn the network defined in the config test [runningNetworkSpec] Run tests on the network defined setup [options] Setup is meant for downloading and making dev environment of ZombieNet ready convert Convert is meant for transforming a (now deprecated) polkadot-launch configuration to zombienet configuration version Prints zombienet version help [command] display help for command ``` -------------------------------- ### Zombienet Test File Header Fields Source: https://paritytech.github.io/zombienet/intro.html/print Defines the initial configuration parameters for a Zombienet test file, including optional description, network definition path, and credentials for Kubernetes provider. ```APIDOC Header Fields: Description: (Optional) long description of the test suite. Network: Path to the network definition file, supported both `json` and `toml` formats. Creds: Credentials file name or `path` to use (Only with `kubernetes` provider), looked for in current directory or `$HOME/.kube/` if filename is passed. ``` -------------------------------- ### Spawn Zombienet Network using Kubernetes Provider Source: https://paritytech.github.io/zombienet/intro.html/print These commands illustrate how to deploy the defined Zombienet network using the `zombienet-linux` tool. The first command explicitly uses the Kubernetes provider, while the second leverages Kubernetes as the default provider for network spawning. ```bash ./zombienet-linux -p kubernetes spawn examples/0001-small-network.toml ``` ```bash ./zombienet-linux spawn examples/0001-small-network.toml ``` -------------------------------- ### Execute Zombienet Spawn Command Source: https://paritytech.github.io/zombienet/intro.html/cli/spawn This command line instruction uses the `zombienet-macos` executable to initiate the spawning of a network. It references a previously defined network configuration file located at `examples/0001-small-network.toml`. ```bash ./zombienet-macos spawn examples/0001-small-network.toml ``` -------------------------------- ### Zombienet DSL: System Event Assertions Source: https://paritytech.github.io/zombienet/intro.html/cli/test-dsl-definition-spec Finds a system event from a subscription by matching a pattern (regex or glob). It's important to note that this assertion only matches events occurring after the test starts. An optional timeout can be provided. ```Zombienet DSL node-name: system event (contains|matches)( regex| glob) "pattern" [within x seconds] ``` ```Zombienet DSL alice: system event matches ""paraId":[0-9]+" within 10 seconds ``` -------------------------------- ### Add ZombieNet Binaries to PATH Source: https://paritytech.github.io/zombienet/intro.html/development Instructs the user to add the directory containing ZombieNet's downloaded binaries to their system's PATH environment variable, making them accessible from any location in the terminal. ```bash export PATH=/home///dist:$PATH ``` -------------------------------- ### Keystore Key Types Specification Source: https://paritytech.github.io/zombienet/intro.html/print Details how to specify keystore key types, supporting both short and long formats, and lists predefined key type schemas for various blockchain components. ```APIDOC keystore_key_types: Object - Description: Defines how to specify key types and lists predefined schemas. - Specification: - short: `audi` - creates `audi` key type that defaults to predefined schema, it predefined schema for given key type doesn't exist it is ignored - long: `audi_sr` - creates `audi` key type with `sr` schema - Schemas: `ed`, `ec`, `sr` - Predefined key type schemas: - aura: `sr` if statemint or asset hub polkadot parachain, otherwise `ed` - babe: `sr` - imon: `sr` - gran: `ed` - audi: `sr` - asgn: `sr` - para: `sr` - beef: `ec` - nmbs: `sr` - rand: `sr` - rate: `ed` - acco: `sr` - bcsv: `sr` - ftsv: `ed` ``` -------------------------------- ### ZombieNet Command-Line Interface (CLI) Reference Source: https://paritytech.github.io/zombienet/intro.html/cli/index Detailed documentation for the ZombieNet command-line tool, outlining global options, available commands, their arguments, and descriptions. This serves as the primary API reference for interacting with ZombieNet via the terminal. ```APIDOC ./zombienet-macos Usage: zombienet [options] [command] Options: -c, --spawn-concurrency Number of concurrent spawning process to launch, default is 1 -p, --provider Override provider to use (choices: "podman","kubernetes", "native", default: kubernetes) -d, --dir Directory path for placing the network files instead of random temp one (e.g. -d /home/user/my-zombienet) -l, --logType " Type of logging on the console - defaults to 'table'" (choices: "table", "text", "silent") -f, --force Force override all prompt commands -m, --monitor Start as monitor, do not auto cleanup network -h, --help display help for command Commands: spawn [creds] Spawn the network defined in the config test [runningNetworkSpec] Run tests on the network defined setup Setup is meant for downloading and making dev environment of ZombieNet ready version Prints zombienet version help [command] display help for command Debug: The debug/verbose output is managed by the DEBUG environment variable, you can enable/disable specific debugging namespaces setting an space or comma-delimited names. $ e.g $ DEBUG=zombie, zombie::paras zombienet spawn example/0001-example.toml The available namespaces are: zombie zombie::chain zombie::cmdGenerator zombie::config zombie::helper zombie::js zombie::kube zombie::metrics zombie::native zombie::network zombie::paras zombie::podman zombie::spawner zombie::substrateCliArgsVersion zombie::test NOTE: wildcard (e.g.'zombie*') are supported, for advance use check https://www.npmjs.com/package/debug#wildcards ``` -------------------------------- ### ZombieNet Convert Command Basic Usage Source: https://paritytech.github.io/zombienet/intro.html/cli/convert Illustrates the fundamental syntax for invoking the `zombienet convert` command, specifying that it requires an `` argument. This command facilitates the migration of Polkadot Launch configurations to the ZombieNet format. ```Shell zombienet convert ``` -------------------------------- ### Define Small Zombienet Network with Relay Chain and Parachain Source: https://paritytech.github.io/zombienet/intro.html/print This TOML configuration defines a Zombienet network featuring a `rococo-local` relay chain with two validator nodes (alice, bob) and a parachain (ID 100) with a collator. It specifies default Docker images, commands, and arguments for the nodes, providing a complete network setup. ```toml [relaychain] default_image = "docker.io/parity/polkadot:latest" default_command = "polkadot" default_args = [ "-lparachain=debug" ] chain = "rococo-local" [[relaychain.nodes]] name = "alice" validator = true [[relaychain.nodes]] name = "bob" validator = true [[parachains]] id = 100 [parachains.collator] name = "collator01" image = "docker.io/parity/polkadot-parachain:latest" command = "polkadot-parachain" args = ["-lparachain=debug"] ``` -------------------------------- ### Zombienet Convert Command Syntax Source: https://paritytech.github.io/zombienet/intro.html/print Syntax for using the `zombienet convert` command, which is designed to help users migrate Polkadot Launch configurations to the Zombienet format. The command requires an input file. ```Shell zombienet convert ``` -------------------------------- ### Spawn Zombienet Network from TOML Configuration Source: https://paritytech.github.io/zombienet/intro.html/print This command executes the `zombienet` CLI tool on macOS to spawn a network defined in the `0001-small-network.toml` configuration file. It initiates the network deployment process based on the specified TOML settings, bringing up all defined nodes and chains. ```Shell ./zombienet-macos spawn examples/0001-small-network.toml ``` -------------------------------- ### Zombienet TOML Configuration with Environment Variable Replacements Source: https://paritytech.github.io/zombienet/intro.html/print TOML configuration for a Zombienet network, demonstrating the use of Nunjucks templating for dynamic image paths via environment variables. It also shows a specific node using an older Polkadot version. ```toml [relaychain] default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" default_command = "polkadot" default_args = [ "-lparachain=debug" ] chain = "rococo-local" [[relaychain.nodes]] name = "alice" validator = true [[relaychain.nodes]] name = "bob" validator = true image= "{{ZOMBIENET_ALTERNATIVE_TEST_IMAGE}}" [[parachains]] id = 100 [parachains.collator] name = "collator01" image = "{{ZOMBIENET_COL_IMAGE}}" command = "polkadot-parachain" ``` -------------------------------- ### Zombienet Global Configuration Settings (`settings`) Source: https://paritytech.github.io/zombienet/intro.html/print Defines various global configuration parameters for Zombienet, controlling network behavior, deployment providers (e.g., Kubernetes, Podman), and observability features such as Jaeger and Tempo tracing integration. These settings influence how the entire Zombienet network is spawned and managed. ```APIDOC settings: bootnode: type: Boolean default: true description: Add bootnode to network. timeout: type: number description: Global timeout to use for spawning the whole network. provider: type: String default: kubernetes description: Provider to use (e.g kubernetes, podman). backchannel: type: Boolean default: false description: Deploy an instance of backchannel server. Only available on kubernetes. polkadot_introspector: type: Boolean default: false description: Deploy an instance of polkadot-introspector, only available on podman and kubernetes. jaeger_agent: type: String description: The jaeger agent endpoint passed to the nodes, only available on kubernetes. enable_tracing: type: Boolean default: true description: Enable the tracing system, only available on kubernetes. tracing_collator_url: type: String description: The url of the tracing collator used to query by the tracing assertion (Should be tempo query compatible). tracing_collator_service_name: type: String default: tempo-tempo-distributed-query-frontend description: Service name for tempo query frontend, only available on kubernetes. tracing_collator_service_namespace: type: String default: tempo description: Namespace where tempo is running, only available on kubernetes. tracing_collator_service_port: type: Number default: 3100 description: Port of the query instance of tempo, only available on kubernetes. node_spawn_timeout: type: Number default: per provider description: Timeout to spawn pod/process. local_ip: type: String default: "127.0.0.1" description: IP used for expose local services (rpc/metrics/monitors). node_verifier: type: String default: Metric possible_values: "None", "Metric" description: Allow to manage how we verify node readiness or disable (None). isolate_env: type: boolean default: false description: If true, zombienet will add a random suffix to protocolId (in the chain-spec) and will add the forkId field with the same value of the protocolId (plus the suffix). This will isolate the network since the prefix used in p2p protocols will not match with other networks (mostly used to run multiple networks in native provider). ``` -------------------------------- ### Zombienet Network Configuration with Environment Variables Source: https://paritytech.github.io/zombienet/intro.html/print This TOML snippet demonstrates how to define a Zombienet network configuration. It showcases the use of `{{ENV_VAR_NAME}}` syntax for dynamic replacement of values like image paths, allowing for flexible and environment-agnostic network definitions. ```TOML [relaychain] default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" chain = "rococo-local" [[relaychain.nodes]] name = "alice" [[relaychain.nodes]] name = "bob" [[parachains]] id = 100 add_to_genesis = false [parachains.collator] name = "collator01" image = "{{COL_IMAGE}}" command = "adder-collator" ```