pub struct RecordRequest {
pub suite: Option<PathBuf>,
pub crate_output: Option<PathBuf>,
pub origin: Origin,
pub run: Option<RunRef>,
pub provenance: BTreeMap<EvidenceProducer, EvidenceProvenance>,
pub coverage: Option<PathBuf>,
pub ledger: LedgerTarget,
pub run_record: Option<PathBuf>,
}Expand description
What to record, and where from.
Both sources are optional and independent — a run of the suite, a run of the crate, or one invocation recording both — but a request that names neither is refused rather than recording an empty run as if nothing had failed.
use majordomus_cli::evidence::{record, Origin, RecordRequest};
let nothing = RecordRequest::default();
let root = tempfile::tempdir().unwrap();
let refused = record(root.path(), ¬hing).unwrap_err().to_string();
assert!(refused.contains("nothing to record"), "{refused}");
let suite_run =
RecordRequest { suite: Some("tmp/run.tsv".into()), ..RecordRequest::new(Origin::Ci) };
assert_eq!(suite_run.origin, Origin::Ci);
assert_eq!(suite_run.suite.as_deref(), Some(std::path::Path::new("tmp/run.tsv")));§Example
use majordomus_cli::evidence::{Origin, RecordRequest};
let r = RecordRequest::new(Origin::Ci);
assert_eq!(r.origin, Origin::Ci);Fields§
§suite: Option<PathBuf>The runner’s TSV report, when a suite run is being recorded.
crate_output: Option<PathBuf>cargo test’s output, when a crate run is being recorded.
origin: OriginWhere the run happened.
run: Option<RunRef>The continuous-integration run to stamp every execution with, when there is one.
provenance: BTreeMap<EvidenceProducer, EvidenceProvenance>What each report’s run measured about its checkout, by producer: values, not paths, so a runner can pass the measurement it just took.
coverage: Option<PathBuf>A coverage summary (scripts/rust-coverage --summary-json), when one is recorded.
ledger: LedgerTargetThe ledger the executions are merged into.
run_record: Option<PathBuf>Where to write the run record as well, when asked.
Implementations§
Source§impl RecordRequest
impl RecordRequest
Sourcepub fn new(origin: Origin) -> RecordRequest
pub fn new(origin: Origin) -> RecordRequest
A recording of nothing yet, from origin, into the tracked ledger: the base every
request is built on, so that a field added later breaks no caller.
use majordomus_cli::evidence::{LedgerTarget, Origin, RecordRequest};
let r = RecordRequest { suite: Some("run.tsv".into()), ..RecordRequest::new(Origin::Ci) };
assert_eq!((r.origin, r.ledger), (Origin::Ci, LedgerTarget::Repo));
assert!(r.provenance.is_empty() && r.coverage.is_none() && r.run_record.is_none());Trait Implementations§
Source§impl Clone for RecordRequest
impl Clone for RecordRequest
Source§fn clone(&self) -> RecordRequest
fn clone(&self) -> RecordRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RecordRequest
impl Debug for RecordRequest
Source§impl Default for RecordRequest
impl Default for RecordRequest
Source§fn default() -> RecordRequest
fn default() -> RecordRequest
A local recording of nothing into the tracked ledger.