This procedure describes how to run tests on a dev system. See the dev setup section of the README first.
Tests also run on GitHub Actions via the following workflow.
Since these tests create block devices and manipulate network interfaces, they need to run as root. If you are not comfortable with this, run them in a virtual machine.
git clone https://github.com/aleph-im/aleph-vm.git
2. Install hatch, the project manager
Since installing tools globally is not recommended, we will install hatch
in a dedicated virtual environment. Alternatives include using pipx
or your distribution.
python3 -m venv /opt/venv
source /opt/venv/bin/activate
# Inside the venv
pip install hatch
It is required that the testing virtual environment relies on system packages
for nftables
instead of the package obtained from salsa.debian.org
as defined in
pyproject.toml.
Create the testing virtual environment:
hatch env create testing
hatch run testing:test
Some tricks and options that might help debugging problematic tests.
Only launch pytest with a test name and more verbose debugging
hatch run testing:pytest -vv --log-level=DEBUG --full-trace -o log_cli=true -k <TEST NAME>
Specify --capture=no
to pytest so it launch. This way you get the full output, including firecracker logs
If the error is in the runtime:
Modify the #! to pass the -v option to python, which will print all the debugging info
#!/usr/bin/python3 -vOO
To have these modification take effect you need to rebuild the runtime file using create_disk_image.sh
as root
sudo bash create_disk_image.sh
Don't forget to have the print system log option set ALEPH_VM_PRINT_SYSTEM_LOGS=1
aleph-debian-12-python
is used in test_create_execution