On this page
ADR-0022: One integration-test binary per crate
Status: Accepted (WP-01 convention, recorded in docs/status/WP-01.md). Applied in every crate.
Context
Cargo builds each file in tests/ as a separate binary that links the whole dependency
tree. With a dozen crates that each have a dozen test topics, that means hundreds of
large binaries, long link times and tens of gigabytes of disk in a shared build
directory.
Decision
Every crate has exactly one integration-test target, tests/it/main.rs, declared as
[[test]]
name = "it"
path = "tests/it/main.rs"
with one module per topic (mod ledger; → tests/it/ledger.rs). A single topic runs with
cargo test -p <crate> --test it <module>::.
Consequences
- Link time and disk use per crate are bounded.
- Some crates (for example
commonlayer-projects) also disable the library's own unit-test target and keep every test in the one binary. - Incremental compilation is disabled for the dev and test profiles and dependencies build without debug information, for the same disk reasons.