diff --git a/tarpc/src/server/in_flight_requests.rs b/tarpc/src/server/in_flight_requests.rs index 67817e2..581eac3 100644 --- a/tarpc/src/server/in_flight_requests.rs +++ b/tarpc/src/server/in_flight_requests.rs @@ -185,11 +185,26 @@ mod tests { async fn remove_request_doesnt_abort() { let mut in_flight_requests = InFlightRequests::default(); let abort_registration = in_flight_requests - .start_request(0, SystemTime::now(), Span::current()) + .start_request( + 0, + SystemTime::now() + std::time::Duration::from_secs(10), + Span::current(), + ) .unwrap(); let mut abortable_future = Box::new(Abortable::new(pending::<()>(), abort_registration)); + // Precondition: Pending expiration + assert_matches!( + in_flight_requests.poll_expired(&mut noop_context()), + Poll::Pending + ); + assert_matches!(in_flight_requests.remove_request(0), Some(_)); + // Postcondition: No pending expirations + assert_matches!( + in_flight_requests.poll_expired(&mut noop_context()), + Poll::Ready(None) + ); assert_matches!( abortable_future.poll_unpin(&mut noop_context()), Poll::Pending