cardano-node-testsο
System and end-to-end (E2E) tests for cardano-node.
π Check the documentation site for full usage guides, setup instructions, and details.
π Running Tests with GitHub Actionsο
Run tests easily using GitHub Actions:
Fork this repository.
Enable GitHub Actions in your fork:
Go to
SettingsβActionsβGeneralβActions permissionsCheck β
Allow all actions and reusable workflows
Navigate to the
Actionstab, then choose:01 Regression tests, or02 Regression tests with db-sync, or03 Upgrade tests
Click
Run workflowto start testing.
π₯οΈ Running Tests Locallyο
The preferred way is via runner/runc.sh, which builds a container image and runs tests inside it using podman or docker. If the host has /nix, it is bind-mounted into an Alpine container; otherwise a self-contained NixOS container is used β no local Nix installation required.
./runner/runc.sh ./runner/regression.sh
Run a specific test:
./runner/runc.sh -- TEST_THREADS=0 CLUSTERS_COUNT=1 PYTEST_ARGS="-k test_minting_one_token" ./runner/regression.sh
A specific Linux distro can be selected (Ubuntu, Debian, Linux Mint, or NixOS):
./runner/runc.sh --ubuntu-container=24.04 -- ./runner/regression.sh
βΉοΈ Run
./runner/runc.shwithout arguments to see all available options.
Alternatively, with Nix available on the host, tests can be run directly:
./runner/regression.sh
Or run the upgrade test suite:
./runner/load-gh-env.sh runner/env_nightly_upgrade CI_BYRON_CLUSTER=false ./runner/node_upgrade.sh
π§ͺ Running Individual Tests with Custom Binariesο
Add your custom
cardano-cli/cardano-nodebinaries to the.bindirectory.Run a specific test:
./runner/runc.sh -- TEST_THREADS=0 CLUSTERS_COUNT=1 PYTEST_ARGS="-k 'test_minting_and_burning_sign[asset_name-build_raw-submit_cli]'" ./runner/regression.sh
Clean up by removing binaries from
.binafter tests complete.
βΉοΈ Pro Tip: Enable full CLI command logging:
PYTEST_ARGS="... --log-level=debug" ./runner/regression.sh
π Persistent Local Testnet for Repeated Testingο
For workflows requiring repeated test runs on a persistent testnet cluster:
Start a Nix shell:
nix flake update --accept-flake-config --override-input cardano-node github:IntersectMBO/cardano-node/master nix develop --accept-flake-config
Set up the local test environment:
make test-envActivate the environment:
source ./dev_workdir/activate
Launch the local testnet cluster:
make start-clusterRun your tests:
pytest -s -k test_minting_one_token cardano_node_tests/tests/tests_plutus pytest -s --log-level=debug -k test_minting_one_token cardano_node_tests/tests/tests_plutus
Stop the testnet cluster:
make stop-cluster
βΉοΈ Pro Tip: Next time, you can omit step 2 if the environment is already set up.
βοΈ Test Configuration Variablesο
You can fine-tune test runs using these environment variables:
Variable |
Description |
|---|---|
|
Bootstrap testnet directory. |
|
Number of clusters to launch (default: 9). |
|
Cluster era (default: |
|
CLI command target era. |
|
Donβt shut down clusters after tests. |
|
Marker expression for pytest filtering. |
|
Max tests per cluster (default: 8). |
|
Number of stake pools (default: 3). |
|
Starting port number for cluster services. |
|
Path to scheduler log output. |
|
Name of the testnet variant to use. |
|
Backend type: |
|
List of UTXO backends for mixed setup. |
|
Enable tx-generator (default: |
|
Cardano protocol version to use (default: |
|
Switch to using |
|
Allow tests to pass with unstable error messages. |
Additional for regression.shο
Variable |
Description |
|---|---|
|
|
|
Run cluster from Byron β Conway (slow start). |
|
|
|
|
|
Extra options passed to pytest. |
|
Number of pytest workers (default: |
π‘ Usage Examplesο
Run with 6 pools and mixed networking:
NUM_POOLS=6 ./runner/regression.sh
Run selective tests with filtering:
TEST_THREADS=15 PYTEST_ARGS="-k 'test_stake_pool_low_cost or test_reward_amount'" MARKEXPR="not long" ./runner/regression.sh
Run on preview testnet with specific node revision:
NODE_REV=10.6.3 BOOTSTRAP_DIR=~/tmp/preview_config/ ./runner/regression.sh
βΉοΈ Pro Tip: All the examples above can be prefixed with
./runner/runc.sh --to run inside the containerized environment.
π€ Contributingο
Follow the Google Python Style Guide.
See CONTRIBUTING.md for full guidelines.