use super::{
assert_acked, assert_break_sent_to, assert_in_our_console, connect_reporter, kill_release_reap, report_done,
spawn_member, Handler,
};
use crate::{Containment, GracefulMechanism};
pub(crate) const REPORTER_TEST: &str = "test_child::ctrl_break::nested::fixture_nested_terminate_reporter";
pub(crate) const ADDR_ENV: &str = "COSCA_FIXTURE_NESTED_TERMINATE_ADDR";
#[skuld::test]
fn fixture_nested_terminate_reporter() {
let Some(mut report) = connect_reporter(ADDR_ENV) else {
return;
};
let _warns = crate::log_capture::warn_watch();
let (child, mut sock, _) = spawn_member(Handler::Ack, None, crate::ContainMode::Strongest, |_| {});
let pid = child.pid();
assert_eq!(
child.containment(),
Containment::Delegated,
"this process is contained, so its own spawn is nested"
);
assert_eq!(child.graceful_mechanism(), GracefulMechanism::ConsoleGroup);
assert_in_our_console(pid, "the nested member");
assert!(
matches!(child.terminate_tree(), Err(crate::error::Error::Unsupported { .. })),
"a nested member still owns no tree teardown"
);
child.terminate().expect("terminate a nested console-group child");
assert_break_sent_to(pid);
assert_acked(&mut sock, "the nested member");
kill_release_reap(&child, sock, false);
report_done(&mut report);
}