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

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();