Watch
0
0
Fork
You've already forked hyperhive
0

swarm-builder: an agent option whose eval failed is left out of the reply, not read as its default

This commit is contained in:
atlas 2026-11-06 10:03:18 +01:00 • committed by mara
commit 5d2b0c9a54
2 changed files with 340 additions and 158 deletions

View file

@ -564,8 +564,8 @@ mod tests {
system: "x86_64-linux".to_owned(),
built_unix: 7,
cached,
private_users: false,
nix_builds: NixBuilds::Host,
private_users: Some(false),
nix_builds: Some(NixBuilds::Host),
}
}
@ -652,8 +652,8 @@ mod tests {
out_path: out_path.to_owned(),
system: "x86_64-linux".to_owned(),
cached,
private_users: false,
nix_builds: NixBuilds::Host,
private_users: Some(false),
nix_builds: Some(NixBuilds::Host),
}
}
@ -916,15 +916,15 @@ mod tests {
out_path,
system,
cached,
private_users: true,
nix_builds: NixBuilds::Disabled,
private_users: Some(true),
nix_builds: Some(NixBuilds::Disabled),
};
let world = Fake::missing(&["iris"]).answering("iris", answer);
pass_at(&world, &mut Backoff::default(), Instant::now()).await;
let writes = world.writes();
assert_eq!(writes.len(), 1);
assert!(writes[0].1.private_users);
assert_eq!(writes[0].1.nix_builds, NixBuilds::Disabled);
assert_eq!(writes[0].1.private_users, Some(true));
assert_eq!(writes[0].1.nix_builds, Some(NixBuilds::Disabled));
}
#[tokio::test]
async fn another_path_leaves_a_record_that_moved_on() {

View file

@ -492,10 +492,14 @@ mod tests {
}
fn built_cached(cached: bool) -> Self {
Self::built_with(cached, false, NixBuilds::Host)
Self::built_with(cached, Some(false), Some(NixBuilds::Host))
}
fn built_with(cached: bool, private_users: bool, nix_builds: NixBuilds) -> Self {
fn built_with(
cached: bool,
private_users: Option<bool>,
nix_builds: Option<NixBuilds>,
) -> Self {
Self::answering(Ok(FromMetaReply::Built {
out_path: "/nix/store/x-toplevel".to_owned(),
system: "x86_64-linux".to_owned(),
@ -629,11 +633,15 @@ mod tests {
}
}
/// The record says what the builder said about the agent's user namespace,
/// both ways; a builder that said nothing leaves it off.
/// The record says what the builder said about the agent's user namespace
/// and nix builds, both ways; an option the builder left unread stays unread.
#[tokio::test]
async fn the_record_carries_the_builders_user_namespace_and_nix_builds_answers() {
for (private_users, nix_builds) in [(true, NixBuilds::Disabled), (false, NixBuilds::Host)] {
for (private_users, nix_builds) in [
(Some(true), Some(NixBuilds::Disabled)),
(Some(false), Some(NixBuilds::Host)),
(None, None),
] {
let queue = FakeQueue::built_with(true, private_users, nix_builds);
let outcome = run_with(&FakeHead::reading(Ok(Some(REV))), &queue).await;
assert_eq!(outcome, Outcome::Done);
@ -927,8 +935,8 @@ mod tests {
system: "x86_64-linux".to_owned(),
built_unix: 1,
cached: false,
private_users: true,
nix_builds: NixBuilds::Disabled,
private_users: Some(true),
nix_builds: Some(NixBuilds::Disabled),
};
client.record("atlas", &closure).await.expect("written");
closure.store_path = "/nix/store/b".to_owned();