3 releases (breaking)
Uses new Rust 2024
| new 0.45.0 | Feb 4, 2026 |
|---|---|
| 0.41.0 | Jan 15, 2026 |
| 0.1.0 | Aug 3, 2025 |
#168 in Filesystem
805 downloads per month
Used in 6 crates
740KB
15K
SLoC
DiskANN
Stay tuned for more updates!
Developer Docs
Test Baselines
Developers are strongly encouraged to consider the caching infrastructure when writing index tests to provide an early warning of algorithmic changes.
This infrastructure serializes test results into a file in diskann/tests/generated
that serves as the baseline in the normal test flow. Any difference between the baseline
result and a test value gets flagged as a test failure for further review.
To regenerate baselines, run the test with the environment variable:
DISKANN_TEST=overwrite
Since tests are in a (somewhat) human readable JSON form, regenerated results can be inspected during the review process to flag regressions early.
Before checking in new test results, it's a good idea to completely delete diskann/tests/generated
to ensure that unused baselines get removed from the repository.
The API for registering and retrieving test results is in diskann/src/tests/cache
and consists of:
-
fn get_or_save_test_results<R>(test_name: &str, results: &R) -> R: Get the results fortest_namein normal testing mode, or saveresultsas a baseline when in overwrite mode.Argument
test_nameconsists of paths separated by a/likea/b/testthat will get saved todiskann/tests/generated/a/b/test.json. -
TestRootandTestPath: Utilities for efficiently incrementally buildingtest_name.
The above API will return the previously saved baseline in the normal test mode, which can
be compared with the results argument.
When comparing baselines, developers should use the diskann::tests::cmp::VerboseEq
which provides more diagnostics regarding the source of structural inequality than the
standard libraries PartialEq trait. Additional utilities include
-
diskann::tests::cmp::verbose_eq!: A trait for automatically implementingVerboseEq. This macro can be used until a properderivemacro is implemented:use diskann::test::cmp::verbose_eq; struct MyStruct { a: String, b: f32, c: usize, } // Implement the `VerboseEq` trait for `MyStruct`. verbose_eq!(MyStruct { a, b, c }); -
diskann::test::cmp::assert_eq_verbose!: The equivalent of the standard library'sassert_eqbut usingVerboseEqto provide more information on the test failure.
The DiskANN team thanks INFINI Labs for transferring ownership of the diskann crate!
Dependencies
~11–15MB
~185K SLoC