Watch
0
0
Fork
You've already forked hyperhive
0

record whether an agent's config sets privateUsers in its closure record

This commit is contained in:
atlas 2026-11-01 16:05:36 +01:00 • committed by mara
commit 3ca660e558

View file

@ -36,6 +36,12 @@ pub struct AgentClosure {
/// written before the field existed reads as false.
#[serde(default)]
pub cached: bool,
/// Whether the agent's evaluated config sets
/// `services.hyperhive.agent.user.privateUsers`: the agent runs in its own
/// user namespace. A record written before the field existed reads as
/// false, which keeps the agent out of one.
#[serde(default)]
pub private_users: bool,
}
#[cfg(test)]
@ -56,6 +62,7 @@ mod tests {
system: "x86_64-linux".to_owned(),
built_unix: 7,
cached: true,
private_users: true,
};
let wire = serde_json::json!({
"meta_rev": "abc",
@ -63,6 +70,7 @@ mod tests {
"system": "x86_64-linux",
"built_unix": 7,
"cached": true,
"private_users": true,
});
assert_eq!(serde_json::to_value(&value).expect("encodes"), wire);
assert_eq!(
@ -72,7 +80,7 @@ mod tests {
}
#[test]
fn a_record_without_the_field_reads_as_not_cached() {
fn a_record_without_the_fields_reads_as_not_cached_and_not_namespaced() {
let old = serde_json::json!({
"meta_rev": "abc",
"store_path": "/nix/store/x",
@ -81,5 +89,6 @@ mod tests {
});
let record = serde_json::from_value::<AgentClosure>(old).expect("decodes");
assert!(!record.cached);
assert!(!record.private_users);
}
}