test the deployed-rev check and the update-chip comparison. Refs #5913
This commit is contained in:
parent
862495530c
commit
db4f8a7b15
1 changed files with 42 additions and 4 deletions
|
|
@ -52,7 +52,13 @@ pub fn current_flake_rev(hyperhive_flake: &str) -> Option<String> {
|
|||
#[must_use]
|
||||
pub fn agent_config_pending(name: &str, deployed: Option<&str>) -> bool {
|
||||
let pinned = crate::meta_rev::recorded(name).and_then(|build| build.config);
|
||||
match (pinned.as_deref(), deployed) {
|
||||
config_pending(pinned.as_deref(), deployed)
|
||||
}
|
||||
|
||||
/// The comparison behind [`agent_config_pending`]: pending only when both
|
||||
/// commits are known and differ.
|
||||
fn config_pending(pinned: Option<&str>, deployed: Option<&str>) -> bool {
|
||||
match (pinned, deployed) {
|
||||
(Some(pinned), Some(deployed)) => pinned != deployed.trim(),
|
||||
_ => false,
|
||||
}
|
||||
|
|
@ -284,7 +290,7 @@ fn submit_boot_tree(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{BootAction, boot_action};
|
||||
use super::{BootAction, boot_action, config_pending};
|
||||
use crate::power::Wanted;
|
||||
|
||||
// The regression the `Unreadable` variant exists for: the arm used to
|
||||
|
|
@ -350,4 +356,15 @@ mod tests {
|
|||
BootAction::Defer { reconcile: true }
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_is_pending_only_when_the_pins_differ() {
|
||||
assert!(config_pending(Some("bbb"), Some("aaa")));
|
||||
assert!(
|
||||
!config_pending(Some("aaa"), Some("aaa\n")),
|
||||
"marker newline"
|
||||
);
|
||||
assert!(!config_pending(None, Some("aaa")), "archetype agent");
|
||||
assert!(!config_pending(Some("aaa"), None), "never built");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue