tests/src/lib.rs
//! Shared helpers for znippy's integration-test crate.
//!
//! The headline export is [`fstatus`] — the one-line bridge each test uses to
//! feed the `nornir test` matrix a functional-status row carrying its REAL
//! assertion result + measured value. It wraps
//! [`nornir_testmatrix::functional_status`] behind this crate's `testmatrix`
//! feature so:
//!
//! * **release / default** (feature OFF): [`fstatus`] is a `#[inline(always)]`
//! no-op — the emit is compiled OUT, the matrix dependency edge stays inert,
//! and the tests run exactly as before.
//! * **`--features testmatrix`** (feature ON): each call appends one matrix row
//! (`component`, `check`, `ok`, `detail`) so a green functional matrix proves
//! every wired check actually passed — not merely that the test binary ran.
/// Emit one functional-status row into the `nornir` test matrix for a single
/// real check. `ok` is the REAL assertion result; `detail` is the MEASURED
/// value (a byte count, a file count, a checksum, a route name …).
///
/// No-op (compiled out) unless the `testmatrix` feature is enabled.
#[cfg(feature = "testmatrix")]
#[inline]
pub fn fstatus(component: &str, check: &str, ok: bool, detail: &str) {
nornir_testmatrix::functional_status(component, check, ok, detail);
}
/// Release-path shape: identical signature, compiled to nothing.
#[cfg(not(feature = "testmatrix"))]
#[inline(always)]
pub fn fstatus(_component: &str, _check: &str, _ok: bool, _detail: &str) {}