Running Tests
Full Test Suite
To run the complete test suite:Running Specific Tests
Test a Specific Package
Test a Specific Module
Run a Single Test
Test Types
Unit Tests
Unit tests are embedded in the source code and test individual functions and modules:Integration Tests
Integration tests are in thetests/ directories and test component interactions:
Documentation Tests
Documentation examples are also tested:Pre-Commit Testing
Before pushing code, run these sanity checks:All pull requests must pass these checks before merging. Running them locally saves time in code review.
Benchmarking
Agave uses criterion for benchmarking. Benchmarks require the nightly Rust toolchain.Setup for Benchmarking
Running Specific Benchmarks
Comparing Benchmark Results
Benchmark results are saved intarget/criterion/. You can compare results across runs to measure performance improvements or regressions.
When submitting performance-related changes, include benchmark results in your pull request to demonstrate the improvement.
Code Coverage
Generating Coverage Reports
Agave provides a script to generate code coverage statistics:Coverage Philosophy
Agave views code coverage primarily as a developer productivity metric rather than just a quality metric:- Tests encode problems: The unit test suite represents the set of problems the codebase solves
- Coverage protects solutions: Adding tests protects your solution from future changes
- Coverage aids understanding: If you don’t understand why code exists, try deleting it and running tests - the nearest failure tells you what problem it solved
- Missing coverage indicates opportunity: If no test fails when you delete code, either:
- The code is unnecessary (submit a PR asking about it)
- A test is missing (consider adding one)
Coverage Requirements
All changes should include tests covering at least 90% of added code paths. Tests should:- Run quickly
- Be reliable (not flaky)
- Cover both success and error cases
- Use relevant test cases for stress testing
Test Infrastructure
Local Testnet
To test validator functionality locally, start a local testnet:Development Cluster
For testing against a live network, use devnet:- devnet - Stable public cluster for development
- Available at
devnet.solana.com - Runs 24/7 with the latest features
- See public clusters documentation for details
Continuous Integration
All tests run automatically in CI on:- Every pull request
- Every commit to master
- Every release branch
Troubleshooting Tests
Tests Timing Out
If tests are timing out:Flaky Tests
If you encounter flaky tests:- Run the test multiple times to confirm flakiness
- Check if the test depends on timing or external resources
- Report flaky tests to maintainers - they should be fixed or removed
Out of Disk Space
Tests can generate significant temporary data:Next Steps
- Review contributing guidelines for code standards
- Learn about the release process
- Submit your changes following the PR workflow