π‘ 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
-
Click
Run workflowto start testing.
-
Install and configure Nix using the official guide.
-
Clone this repository.
-
Run the test suite:
./.github/regression.shβΉοΈ NOTE: Using
CI_BYRON_CLUSTERwill cause the local cluster to progress from Byron β Conway, which takes approximately 40 minutes.
-
Add your custom
cardano-cli/cardano-nodebinaries to the.bindirectory. -
Run a specific test:
TEST_THREADS=0 CLUSTERS_COUNT=1 PYTEST_ARGS="-k 'test_minting_and_burning_sign[asset_name-build_raw-submit_cli]'" ./.github/regression.sh- Clean up by removing binaries from
.binafter tests complete.
βΉοΈ Pro Tip: Enable full CLI command logging:
PYTEST_ARGS="... --log-level=debug" ./.github/regression.shFor workflows requiring repeated test runs on a persistent 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- Prepare the test environment:
source ./prepare_test_env.sh conway- Launch the cluster:
./dev_workdir/conway_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 cluster:
./dev_workdir/conway_fast/stop-clusterTo reuse the same environment in another shell:
source ./dev_workdir/.sourceYou can fine-tune test runs using these environment variables:
| Variable | Description |
|---|---|
SCHEDULING_LOG |
Path to scheduler log output. |
PYTEST_ARGS |
Extra options passed to pytest. |
MARKEXPR |
Marker expression for pytest filtering. |
TEST_THREADS |
Number of pytest workers (default: 20). |
MAX_TESTS_PER_CLUSTER |
Max tests per cluster (default: 8). |
CLUSTERS_COUNT |
Number of clusters to launch (default: 9). |
CLUSTER_ERA |
Cluster era (default: conway). |
COMMAND_ERA |
CLI command target era. |
NUM_POOLS |
Number of stake pools (default: 3). |
ENABLE_LEGACY |
Use legacy networking. |
MIXED_P2P |
Use a mix of P2P and legacy networking. |
UTXO_BACKEND |
Backend type: mem or disk. |
TESTNET_VARIANT |
Name of the testnet variant to use. |
BOOTSTRAP_DIR |
Bootstrap testnet directory. |
KEEP_CLUSTERS_RUNNING |
Don't shut down clusters after tests. |
PORTS_BASE |
Starting port number for cluster services. |
| Variable | Description |
|---|---|
CI_BYRON_CLUSTER |
Run cluster from Byron β Conway (slow). |
NODE_REV |
cardano-node version (default: master). |
DBSYNC_REV |
cardano-db-sync version. |
CARDANO_CLI_REV |
cardano-cli version. |
PLUTUS_APPS_REV |
plutus-apps version (default: main). |
Run with 6 pools and mixed networking:
NUM_POOLS=6 MIXED_P2P=1 ./.github/regression.shRun selective tests with filtering:
TEST_THREADS=15 PYTEST_ARGS="-k 'test_stake_pool_low_cost or test_reward_amount'" MARKEXPR="not long" ./.github/regression.shRun on preview testnet with specific node revision:
NODE_REV=10.5.1 BOOTSTRAP_DIR=~/tmp/preview_config/ ./.github/regression.shmake installcd ../cardano-node
git checkout <tag>
nix develop .#devops
/bin/bash --login # fresh shell needed
cd ../cardano-node-tests
source "$(poetry env info --path)"/bin/activate
export PYTHONPATH="$(echo $VIRTUAL_ENV/lib/python3*/site-packages):$PYTHONPATH"
export CARDANO_NODE_SOCKET_PATH="$PWD/dev_workdir/state-cluster0/bft1.socket" DEV_CLUSTER_RUNNING=1
mkdir -p "${CARDANO_NODE_SOCKET_PATH%/*}"
prepare-cluster-scripts -c -d dev_workdir/conway_fast -t conway_fast
./dev_workdir/conway_fast/start-clusterKeys and configs are stored under
./dev_workdir/state-cluster0.
make check_dev_envpytest -k "test_missing_tx_out or test_multiple_same_txins" cardano_node_tests
pytest -m smoke cardano_node_tests/tests/test_cli.pysource "$(poetry env info --path)"/bin/activate
make lintsource "$(poetry env info --path)"/bin/activate
make install
pip uninstall cardano-clusterlib
cd ../cardano-clusterlib-py
pip install -e . --config-settings editable_mode=compat
cd -
python -c 'from cardano_clusterlib import clusterlib_klass; print(clusterlib_klass.__file__)'
β οΈ After each dependencies update, repeat the steps above to retain dev mode.
./poetry_update_deps.shmake doc- Run
pre-commit installto activate Git hooks. - Follow the Google Python Style Guide.
- Use Ruff (via
pre-commit) for formatting. - See CONTRIBUTING.md for full guidelines.