System and end-to-end (E2E) tests for cardano-node.
📘 Check the documentation site for full usage guides, setup instructions, and details.
Run tests easily using GitHub Actions:
-
Fork this repository.
-
Enable GitHub Actions in your fork:
- Go to
Settings➝Actions➝General➝Actions permissions - Check ✅
Allow all actions and reusable workflows
- Go to
-
Navigate to the
Actionstab, then choose:01 Regression tests, or02 Regression tests with db-sync, or03 Upgrade tests
-
Click
Run workflowto start testing.
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.shRun with clock skew on one pool node:
./runner/runc.sh -- TIME_DRIFT_POOL=1 TIME_DRIFT_SPEC='+0 x1.008' ./runner/regression.shRun a specific test:
./runner/runc.sh -- TEST_THREADS=0 CLUSTERS_COUNT=1 PYTEST_ARGS="-k test_minting_one_token" ./runner/regression.shRun the upgrade test suite with an environment file:
./runner/runc.sh --env-file=runner/env_nightly_upgrade -- CI_BYRON_CLUSTER=false ./runner/node_upgrade.shA specific Linux distro can be selected (Ubuntu, Debian, Linux Mint, or NixOS):
./runner/runc.sh --ubuntu-container=24.04 -- ./runner/regression.shUse --no-nix to run in Alpine without mounting /nix, or combine it with
an explicit Ubuntu, Debian, or Mint image. Supply prebuilt binaries via NODE_TAR_URL or .bin:
./runner/runc.sh --no-nix -- NODE_TAR_URL="file://$PWD/node.tar.gz" ./runner/regression.shℹ️ Run
./runner/runc.shwithout arguments to see all available options.
Alternatively, run regression tests directly on the host:
./runner/regression.shWithout Nix, put jq, Python 3.13 or later (with venv), uv, curl and xz on PATH.
Supply the Cardano binaries with NODE_TAR_URL or .bin.
Source builds and the db-sync PostgreSQL setup still require Nix.
To run the upgrade test suite directly (requires Nix):
./runner/load-gh-env.sh runner/env_nightly_upgrade CI_BYRON_CLUSTER=false ./runner/node_upgrade.shIn AI agent, /analyze-failures [run_dir] triages a finished run (run_workdir by default, also artifacts downloaded from a CI run) and answers where a run's logs and artifacts live.
-
Create the
.bindirectory in the repo root and add your customcardano-cli/cardano-node/cardano-db-syncbinaries there.⚠️ When running in a container viarunner/runc.sh,.binentries must be statically linked binaries, or - for containers that bind-mount the host/nixstore (the default when the host has/nix) - symlinks pointing directly into/nixor binaries whose dynamic dependencies all live under/nix. A NixOS container has its own/nixstore, so only statically linked binaries work there. With--no-nix, copy regular binaries compatible with the selected image into.bin; they must not reference/nix. The launcher usesfileandreadelfon the host to check them. If.binitself points outside the repository, mount its target at the same path with--extra-mount. -
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
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-env
-
Activate the environment:
source ./dev_workdir/activate -
Launch the local testnet cluster:
./dev_workdir/local_fast/start-cluster
-
Run 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:
./dev_workdir/local_fast/stop-cluster
ℹ️ Pro Tip: Next time, you can omit step 2 if the environment is already set up.
You can fine-tune test runs using these environment variables:
| Variable | Description |
|---|---|
BOOTSTRAP_DIR |
Bootstrap testnet directory. |
CLUSTERS_COUNT |
Number of clusters to launch (default: 9). |
COMMAND_ERA |
CLI command target era. |
KEEP_CLUSTERS_RUNNING |
Don't shut down clusters after tests. |
MARKEXPR |
Marker expression for pytest filtering. |
MAX_TESTS_PER_CLUSTER |
Max tests per cluster (default: 8). |
NUM_POOLS |
Number of stake pools (default: 3). |
PORTS_BASE |
Starting port number for cluster services. |
SCHEDULING_LOG |
Path to scheduler log output. |
TESTNET_VARIANT |
Name of the testnet variant to use. |
UTXO_BACKEND |
Backend type: mem, disk, disklmdb or empty. |
MIXED_UTXO_BACKENDS |
List of UTXO backends for mixed setup. |
ENABLE_TX_GENERATOR |
Enable tx-generator (default: false). |
ENABLE_TX_CENTRIFUGE |
Enable tx-centrifuge (default: false). |
ENABLE_TX_FIREHOSE |
Enable tx-firehose (default: false). |
PROTOCOL_VERSION |
Cardano protocol version to use (default: 11). |
USE_GENESIS_MODE |
Switch to using GenesisMode (default: false). |
ALLOW_UNSTABLE_ERROR_MESSAGES |
Allow tests to pass with unstable error messages. |
| Variable | Description |
|---|---|
CARDANO_CLI_REV |
cardano-cli version. |
CI_BYRON_CLUSTER |
Run cluster from Byron ➝ Conway (slow start). |
DBSYNC_REV |
cardano-db-sync version. |
NODE_REV |
cardano-node version (default: master). |
NODE_TAR_URL |
URL of a cardano-node release tarball. |
TX_CENTRIFUGE_REV |
tx-centrifuge version (default: bench/leios-11.0.1). |
TX_FIREHOSE_REV |
tx-firehose version (default: leios-prototype). |
PYTEST_ARGS |
Extra options passed to pytest. |
TEST_THREADS |
Number of pytest workers (default: 20). |
MONITOR_INTERVAL |
Resource snapshot interval in seconds (default: 60). |
ENABLE_TCACHE_STATS |
Upload testrun stats to the tcache (default: true). |
TESTRUN_NAME |
Name the run and mark its stats upload as a release. |
TIME_DRIFT_POOL |
Pool (1-3) for libfaketime clock skew; unset = off. |
TIME_DRIFT_SPEC |
libfaketime FAKETIME string, e.g. +0 x1.008. |
LIBFAKETIME_PATH |
Override path to libfaketimeMT.so.1. |
Run with 6 pools and mixed networking:
NUM_POOLS=6 ./runner/regression.shRun selective tests with filtering:
TEST_THREADS=15 PYTEST_ARGS="-k 'test_stake_pool_low_cost or test_reward_amount'" MARKEXPR="not long" ./runner/regression.shRun on preview testnet with specific node revision:
NODE_REV=10.6.3 BOOTSTRAP_DIR=~/tmp/preview_config/ ./runner/regression.shTest a release artifact inside Ubuntu (use the tarball for your architecture):
./runner/runc.sh --ubuntu-container=24.04 -- \
NODE_TAR_URL=https://github.com/IntersectMBO/cardano-node/releases/download/11.1.3/cardano-node-11.1.3-linux-amd64.tar.gz \
./runner/regression.shFor a smoke run without Nix on Ubuntu, Linux Mint, and Debian with separate artifacts per distro:
./scripts/test_release_assets.sh \
--url=https://github.com/IntersectMBO/cardano-node/releases/download/11.1.3/cardano-node-11.1.3-linux-amd64.tar.gz \
--artifacts-dir=./release-artifactsRepeat --env-file=PATH to pass environment files to each run.
NODE_TAR_URL takes precedence over NODE_REV. .bin can supply other tools, but
cannot contain executables named cardano-node, cardano-cli, cardano-submit-api,
or bech32.
CARDANO_CLI_REV can still override the bundled CLI.
For a GitHub draft release, download the asset while signed in and set
NODE_TAR_URL=file:///absolute/path/to/cardano-node-linux-amd64.tar.gz.
Keep the tarball outside run_workdir. If using runc.sh, use a path visible inside the container.
test_release_assets.sh accepts the same file URL and mounts the tarball read-only for each run.
ℹ️ Pro Tip: Prefix any direct
regression.shcommand with./runner/runc.sh --to run it in a container.
While the setup described in Persistent Local Testnet for Repeated Testing is sufficient for most test development, test authors may require a more customizable environment, such as editable installs, different testnet variants, or multiple testnet cluster instances.
make installcd ../cardano-node
git checkout <tag>
cd ../cardano-node-tests
make update-node-bins repo=../cardano-node
source .source.devmake check-dev-envmake cluster-scripts
make start-clusterThe default cluster variant is local_fast. Override with TESTNET_VARIANT=<variant>, e.g. make cluster-scripts TESTNET_VARIANT=local_slow.
Keys and configs are stored under /var/tmp/cardonnay-of-$USER/state-cluster0.
pytest -k "test_missing_tx_out or test_multiple_same_txins" cardano_node_tests
pytest -m smoke cardano_node_tests/tests/test_cli.pymake lintℹ️ Pro Tip: Run
make init-lintto initialize linters and activate Git hooks.
make reinstall-editable repo=../cardano-clusterlib-py
⚠️ After each dependencies update, repeat the step above to retain dev mode.
This step is required after modifying dependencies in pyproject.toml.
make update-uv-lockmake doc- Follow the Google Python Style Guide.
- See CONTRIBUTING.md for full guidelines.