feat(client): adopt an asynchronous Tokio runtime for the client frontend
This commit is contained in:
8 files changed
+258
-325
No files matched your search
@@ -197,3 +197,25 @@ fn concurrent_submission_and_stop_or_seal_never_lose_an_accepted_receipt() {
|
||||
.expect("every accepted concurrent submission must receive a terminal disposition");
|
||||
});
|
||||
}
|
||||
|
||||
// Joining an isolated worker must leave the caller's executor free to stop it.
|
||||
#[test]
|
||||
fn async_worker_join_allows_concurrent_stop_and_preserves_final_status() {
|
||||
let owner = BlockingManagedClient::start(config(), vec![]).unwrap();
|
||||
let handle = owner.handle();
|
||||
tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
.block_on(async {
|
||||
let joined = owner.join_async();
|
||||
let stop = async { handle.stop().await };
|
||||
let (outcome, ()) =
|
||||
tokio::time::timeout(Duration::from_secs(2), async { tokio::join!(joined, stop) })
|
||||
.await
|
||||
.expect("async join must allow stop on the caller's executor");
|
||||
let outcome = outcome.unwrap();
|
||||
assert_eq!(outcome.end_reason, ManagedEndReason::StopRequested);
|
||||
assert_eq!(handle.status().final_outcome.as_deref(), Some(&outcome));
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user