Watch
0
0
Fork
You've already forked hyperhive
0

hive-agent: compact tests set the harness dir like the other Bus tests

The two report_compact tests build a Bus, which resolves the events db under
HYPERHIVE_HARNESS_DIR and panics when it is unset, as in the nix test
sandbox. Add a test-only paths::with_harness_dir that points the variable at
a temp dir under a lock, and use it in both the new tests and the existing
swarm_inference Bus test, which set the variable unguarded.
This commit is contained in:
atlas 2026-10-11 02:17:16 +02:00 • committed by mara
commit 3c03d82858
3 changed files with 69 additions and 37 deletions

View file

@ -983,16 +983,18 @@ mod tests {
}
fn compact_report(result: Result<(), &str>) -> (bool, Vec<String>) {
let bus = Bus::new();
let mut rx = bus.subscribe();
let ok = report_compact(&bus, result);
let mut notes = Vec::new();
while let Ok(ev) = rx.try_recv() {
if let LiveEvent::Note { text } = ev.event {
notes.push(text);
crate::paths::with_harness_dir(|| {
let bus = Bus::new();
let mut rx = bus.subscribe();
let ok = report_compact(&bus, result);
let mut notes = Vec::new();
while let Ok(ev) = rx.try_recv() {
if let LiveEvent::Note { text } = ev.event {
notes.push(text);
}
}
}
(ok, notes)
(ok, notes)
})
}
#[test]