Skip to main content

declaration_source

Function declaration_source 

Source
pub fn declaration_source(resolved: &Resolved) -> Option<DoctorCheck>
Expand description

The trust-root check: which copy of the declaration is obeyed, and every line of the working tree’s copy this runtime ignores because the trunk’s copy does not say it (super::root). None when there is no declaration to judge.

use majordomus_cli::mesh::doctor::declaration_source;
use majordomus_cli::mesh::root::Resolved;
use majordomus_cli::mesh::MeshConfig;
let config = MeshConfig::from_metadata(
    &serde_json::json!({"schema": "mesh/v1", "kind": "mesh-declaration", "id": "x"}), "x").unwrap();
let ignored = Resolved {
    declaration: Some(Ok(config)),
    trunk: Some("master".into()),
    committed: true,
    narrowed: vec!["trust.allow: bb is not on the trunk".into()],
};
let check = declaration_source(&ignored).unwrap();
assert!(!check.ok && check.detail.contains("bb is not on the trunk"));
let nothing = Resolved { declaration: None, trunk: None, committed: false, narrowed: vec![] };
assert!(declaration_source(&nothing).is_none());