Skip to main content

runs

Function runs 

Source
pub fn runs(root: &Path, q: &EconomicsRunsQuery) -> EconomicsRunList
Expand description

Every recorded live run, narrowed by the query, with its derived totals: the raw facts behind every number, one call away.

Only live suites are read, and a query naming one suite reads no other suite’s records, so a broken record elsewhere is not reported against it.

use majordomus_cli::economics::{runs, model::EconomicsRunsQuery, DIR};
let dir = tempfile::tempdir().unwrap();
assert_eq!(runs(dir.path(), &EconomicsRunsQuery::default()).count, 0);
// a methodology and one live suite `pilot`, whose only record is unreadable
let recorded = dir.path().join(DIR).join("runs/pilot");
std::fs::create_dir_all(&recorded).unwrap();
std::fs::write(recorded.join("r1.json"), "{").unwrap();
let all = runs(dir.path(), &EconomicsRunsQuery::default());
assert_eq!((all.count, all.diagnostics.len()), (0, 1));
let other = EconomicsRunsQuery { suite: Some("other".into()), ..Default::default() };
assert!(runs(dir.path(), &other).diagnostics.is_empty());