chia-blockchain/tests/README.md

54 lines
2.3 KiB
Markdown
Raw Normal View History

2021-03-19 01:47:56 +03:00
# Test CI Job generation
The CI jobs for these tests are managed by `build-workflows.py`.
2021-03-19 01:47:56 +03:00
2021-03-22 22:08:44 +03:00
If you add a test file, or move one to another directory, please run `build-workflows.py`.
2021-03-19 01:47:56 +03:00
Tests are recognized by the file glob `test_*.py`.
Changing the contents of a file does not require running `build-workflows.py`.
2021-03-19 01:47:56 +03:00
We currently use github actions. Default runners have two vcpus.
The workflows are located in [../.github/workflows/](https://github.com/Chia-Network/chia-blockchain/tree/main/.github/workflows).
2021-03-19 01:47:56 +03:00
The inputs to `build-workflows.py` are the templates in `runner-templates`, the file `testconfig.py` in this directory, and the optional `config.py` files in some test subdirectories.
2021-03-19 01:47:56 +03:00
Files in the template directory ending in `include.yml` are included in jobs based on the per-directory settings.
The generated workflows are output to `../.github/workflows/`.
2021-03-19 01:47:56 +03:00
2021-03-22 22:08:44 +03:00
Each subdirectory below the directories `root_test_dirs` in `testconfig.py` becomes a job in the github workflow matrix.
If your jobs run too long, simply move some tests into new subdirectories and run `build-workflows.py`.
2021-03-19 01:47:56 +03:00
A workflow built from a parent directory does not include the tests in its subdirectories.
The subdirectory jobs do not include the tests from their parents.
2021-03-22 22:08:44 +03:00
## testconfig.py
2021-03-19 01:47:56 +03:00
2021-03-22 22:08:44 +03:00
In the top tests directory, [testconfig.py](https://github.com/Chia-Network/chia-blockchain/tree/main/tests/testconfig.py)
2021-03-19 01:47:56 +03:00
contains the application settings and the per-directory default settings.
2021-03-22 22:08:44 +03:00
## config.py
2021-03-19 01:47:56 +03:00
Each directory has an optional `config.py` file, which can override the per-directory default settings.
Per directory settings defaults:
```
parallel = False
checkout_blocks_and_plots = True
install_timelord = True
job_timeout = 30
```
2021-03-22 22:08:44 +03:00
### Parallel test execution
2021-03-19 01:47:56 +03:00
If you are certain that all the tests in a directory can run in parallel, set `parallel = True` in `config.py` inside that directory.
2021-03-19 01:47:56 +03:00
### Optional job stages
Set `checkout_blocks_and_plots` to `False` to omit checking out the [test-cache](https://github.com/Chia-Network/test-cache) repo.
Set `install_timelord` to `False` to omit the step of installing a Time Lord for your directory's job.
### Job Timeout
Set `job_timeout` to the number of minutes you want the CI system to wait before it kills your job.
Add two or three minutes to allow for job setup.