push green meta builds to the attic cache and record cached
This commit is contained in:
parent
c4e8d5b540
commit
0849afec80
1 changed files with 779 additions and 31 deletions
|
|
@ -32,6 +32,10 @@ pub struct AgentClosure {
|
|||
pub system: String,
|
||||
/// When the controller recorded the build, in unix seconds.
|
||||
pub built_unix: i64,
|
||||
/// Whether the builder pushed the closure to the binary cache. A record
|
||||
/// written before the field existed reads as false.
|
||||
#[serde(default)]
|
||||
pub cached: bool,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
@ -51,12 +55,14 @@ mod tests {
|
|||
store_path: "/nix/store/x".to_owned(),
|
||||
system: "x86_64-linux".to_owned(),
|
||||
built_unix: 7,
|
||||
cached: true,
|
||||
};
|
||||
let wire = serde_json::json!({
|
||||
"meta_rev": "abc",
|
||||
"store_path": "/nix/store/x",
|
||||
"system": "x86_64-linux",
|
||||
"built_unix": 7,
|
||||
"cached": true,
|
||||
});
|
||||
assert_eq!(serde_json::to_value(&value).expect("encodes"), wire);
|
||||
assert_eq!(
|
||||
|
|
@ -64,4 +70,16 @@ mod tests {
|
|||
value
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_record_without_the_field_reads_as_not_cached() {
|
||||
let old = serde_json::json!({
|
||||
"meta_rev": "abc",
|
||||
"store_path": "/nix/store/x",
|
||||
"system": "x86_64-linux",
|
||||
"built_unix": 7,
|
||||
});
|
||||
let record = serde_json::from_value::<AgentClosure>(old).expect("decodes");
|
||||
assert!(!record.cached);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue