Watch
0
0
Fork
You've already forked hyperhive
0

remove what no longer has a reader: build-log store, dashboard sent/delivered events, graph resource dep

This commit is contained in:
atlas 2026-11-13 10:08:19 +01:00 • committed by mara
commit 49266e4410

View file

@ -7,7 +7,6 @@ use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};
use hive_jobq::NodeId;
use hive_jobq::scheduler::Scheduler;
use super::{
@ -169,9 +168,8 @@ impl Host for FakeHost {
_hive: &HiveEnv,
_paths: &AgentPaths,
toplevel: &str,
node_id: u64,
) -> anyhow::Result<()> {
self.record(format!("swap_update {name} {toplevel} node={node_id}"));
self.record(format!("swap_update {name} {toplevel}"));
if self.fails("swap_update") {
anyhow::bail!("nixos-container update failed");
}
@ -288,20 +286,6 @@ fn coordinator() -> (tempfile::TempDir, Arc<Coordinator>) {
(dir, Arc::new(coord))
}
/// A real node id, taken from a one-node job in a throwaway queue.
fn node_id() -> NodeId {
let q = crate::job_queue::JobQueue::new(1);
q.insert_job(|b| {
vec![
b.node(NodeKind::AgentWindow {
agent: "alice".to_owned(),
})
.guid(),
]
})
.expect("valid shape")[0]
}
// --- Prebuild ---------------------------------------------------------------
/// What a block logged, level and text: the message and each field.
@ -456,13 +440,12 @@ async fn a_stopped_container_looks_up_nothing() {
async fn swap_applies_the_swarms_closure() {
let (_dir, coord) = coordinator();
let host = FakeHost::down();
let id = node_id();
run_swap(&host, &coord, "alice", id).await.expect("swap ok");
run_swap(&host, &coord, "alice").await.expect("swap ok");
assert_eq!(
host.calls(),
[
format!("realise alice {CLOSURE}"),
format!("swap_update alice {CLOSURE} node={}", id.get()),
format!("swap_update alice {CLOSURE}"),
format!("mark_deployed alice {CLOSURE}"),
"unpin_closure alice".to_owned(),
]
@ -475,7 +458,7 @@ async fn swap_applies_the_swarms_closure() {
async fn a_swap_without_a_closure_never_updates_and_logs_an_error() {
for (case, host, why) in without_a_pinned_closure() {
let (_dir, coord) = coordinator();
let (result, log) = logging(run_swap(&host, &coord, "alice", node_id())).await;
let (result, log) = logging(run_swap(&host, &coord, "alice")).await;
result.expect_err(case);
let errors = log.at(tracing::Level::ERROR);
assert_eq!(errors.len(), 1, "{case}: {errors:?}");
@ -496,8 +479,7 @@ async fn a_swap_without_a_closure_never_updates_and_logs_an_error() {
async fn swap_marks_the_applied_closure_deployed_only_after_the_apply() {
let (_dir, coord) = coordinator();
let host = FakeHost::down();
let id = node_id();
run_swap(&host, &coord, "alice", id).await.expect("swap ok");
run_swap(&host, &coord, "alice").await.expect("swap ok");
assert_eq!(
host.calls()[2],
format!("mark_deployed alice {CLOSURE}"),
@ -506,7 +488,7 @@ async fn swap_marks_the_applied_closure_deployed_only_after_the_apply() {
);
let host = FakeHost::down().failing("swap_update");
run_swap(&host, &coord, "alice", node_id())
run_swap(&host, &coord, "alice")
.await
.expect_err("apply fails");
assert!(
@ -522,7 +504,7 @@ async fn swap_marks_the_applied_closure_deployed_only_after_the_apply() {
async fn a_marker_that_cannot_be_written_does_not_fail_the_swap() {
let (_dir, coord) = coordinator();
let host = FakeHost::down().failing("mark_deployed");
let (result, log) = logging(run_swap(&host, &coord, "alice", node_id())).await;
let (result, log) = logging(run_swap(&host, &coord, "alice")).await;
result.expect("swap ok");
assert_eq!(log.at(tracing::Level::WARN).len(), 1);
}
@ -533,7 +515,7 @@ async fn a_marker_that_cannot_be_written_does_not_fail_the_swap() {
async fn a_failed_swap_reports_the_error_and_touches_no_container() {
let (_dir, coord) = coordinator();
let host = FakeHost::down().failing("swap_update");
let err = run_swap(&host, &coord, "alice", node_id())
let err = run_swap(&host, &coord, "alice")
.await
.expect_err("update failure propagates");
assert!(format!("{err:#}").contains("update failed"), "{err:#}");
@ -882,8 +864,7 @@ async fn a_record_that_changes_mid_rebuild_does_not_change_what_swap_applies() {
run_meta_sync(&host, "alice").await.expect("pinned");
run_prebuild(&host, "alice").await.expect("prebuilt");
host.builder_records(NEWER);
let id = node_id();
run_swap(&host, &coord, "alice", id).await.expect("swapped");
run_swap(&host, &coord, "alice").await.expect("swapped");
let calls = host.calls();
assert_eq!(
calls
@ -894,7 +875,7 @@ async fn a_record_that_changes_mid_rebuild_does_not_change_what_swap_applies() {
"the record is read once: {calls:?}"
);
assert!(
calls.contains(&format!("swap_update alice {CLOSURE} node={}", id.get())),
calls.contains(&format!("swap_update alice {CLOSURE}")),
"{calls:?}"
);
assert!(