chore(app): remove unnecessary tests

This commit is contained in:
Nils Andreas Svee committed 2026-10-05 22:04:07 +07:00
1 parent 5067ceeb1c
commit b1b0b62848
6 files changed
-1261

No files matched your search

@@ -65,69 +65,3 @@ impl Drop for ManagedWorker {
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use irtt_client::managed::{
ManagedClient, ManagedClientConfig, ManagedCompletionPolicy, ManagedEndReason,
};
// The frontend executor must be able to stop a worker while awaiting its
// completion; a blocking join here would deadlock this current-thread runtime.
#[test]
fn completion_leaves_frontend_free_to_stop_and_preserves_outcome() {
let (task, handle) = ManagedClient::task(
ManagedClientConfig {
completion: ManagedCompletionPolicy::ExplicitStop,
..Default::default()
},
vec![],
)
.unwrap();
let worker = ManagedWorker::start(task, handle.clone()).unwrap();
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap()
.block_on(async {
let (outcome, ()) = tokio::time::timeout(Duration::from_secs(2), async {
tokio::join!(worker.join(), handle.stop())
})
.await
.expect("worker completion must allow frontend stop");
let outcome = outcome.unwrap();
assert_eq!(outcome.end_reason, ManagedEndReason::StopRequested);
assert_eq!(handle.status().final_outcome.as_deref(), Some(&outcome));
});
}
// Cancelling the frontend's completion wait must stop and join the worker,
// rather than detaching an ongoing measurement task.
#[test]
fn cancelling_completion_stops_and_joins_worker() {
use std::{
future::Future,
task::{Context, Waker},
};
let (task, handle) = ManagedClient::task(
ManagedClientConfig {
completion: ManagedCompletionPolicy::ExplicitStop,
..Default::default()
},
vec![],
)
.unwrap();
let worker = ManagedWorker::start(task, handle.clone()).unwrap();
let mut completion = Box::pin(worker.join());
assert!(completion
.as_mut()
.poll(&mut Context::from_waker(Waker::noop()))
.is_pending());
drop(completion);
assert_eq!(
handle.status().final_outcome.as_ref().unwrap().end_reason,
ManagedEndReason::StopRequested
);
}
}