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:
parent
2c4a3c2fa7
commit
3c03d82858
3 changed files with 69 additions and 37 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Reference in a new issue