| Crates.io | tank-tests |
| lib.rs | tank-tests |
| version | 0.16.0 |
| created_at | 2025-09-28 14:58:58.023991+00 |
| updated_at | 2026-01-20 23:41:42.926545+00 |
| description | Test suide for drivers of Tank: the Rust data layer. This is intended to be used by drivers to implement common unit tests. |
| homepage | |
| repository | https://github.com/TankHQ/tank |
| max_upload_size | |
| id | 1858408 |
| size | 251,360 |
Reusable integration test suite for the for Tank: the Rust data layer. Instead of duplicating many nearly identical tests inside every driver crate, tank-tests centralizes them with feature flags so each driver can opt out gracefully skipping unsupported features.
Each module focuses on a distinct aspect of Tank functionality. They are orchestrated by execute_tests in src/lib.rs.
The crate exposes opt-out feature flags ("disable-*") that skip entire capability families when a driver cannot yet support them.
| Flag | Skips tests that use |
|---|---|
disable-arrays |
Fixed-size arrays |
disable-intervals |
Interval an advanced duration handling |
disable-large-integers |
i128 and u128 columns |
disable-lists |
List/array-like dynamic collection types |
disable-maps |
Map containers |
disable-ordering |
Explicit result ordering |
disable-references |
Referential integrity |
disable-transactions |
Transaction begin/commit/rollback coverage |
Use them from the driver crate's Cargo.toml:
[dev-dependencies]
tank-tests = { version = "1", features = ["disable-arrays", "disable-lists", "disable-maps"] }
execute_tests in a tokio::test.init_logs() to get structured output.#[cfg(test)]
mod tests {
use std::sync::Mutex;
use tank_core::Driver;
use tank_mydb::{MyDBConnection, MyDBDriver};
use tank_tests::{execute_tests, init_logs};
static MUTEX: Mutex<()> = Mutex::new(());
#[tokio::test]
async fn mydb() {
init_logs();
let _guard = MUTEX.lock().unwrap();
let driver = MyDBDriver::new();
let connection = driver.connect("mydb://localhost:5555".into())
.await
.expect("Could not connect to MyDB");
execute_tests(connection).await; // Runs all enabled modules sequentially
}
}
init_logs() sets a test-friendly format and default WARN level (override via RUST_LOG).silent_logs! { ... } macro temporarily mutes logging for false positive error logs when they are expected.