test(http): wrap timeout test with rt::time::timeout (#3915)

This commit is contained in:
Yuki Okushi 2026-02-11 13:57:29 +09:00 committed by GitHub
parent 4f0912d1c7
commit 9f679990ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 4 deletions

View File

@ -149,10 +149,16 @@ async fn h2_content_length() {
{
let req = srv.request(Method::HEAD, srv.surl("/0")).send();
req.await.expect_err("should timeout on recv 1xx frame");
actix_rt::time::timeout(Duration::from_secs(15), req)
.await
.expect("request future stalled on recv 1xx frame")
.expect_err("should timeout on recv 1xx frame");
let req = srv.request(Method::GET, srv.surl("/0")).send();
req.await.expect_err("should timeout on recv 1xx frame");
actix_rt::time::timeout(Duration::from_secs(15), req)
.await
.expect("request future stalled on recv 1xx frame")
.expect_err("should timeout on recv 1xx frame");
let req = srv.request(Method::GET, srv.surl("/1")).send();
let response = req.await.unwrap();

View File

@ -219,13 +219,19 @@ async fn h2_content_length() {
let req = srv
.request(Method::HEAD, srv.surl(&format!("/{}", i)))
.send();
let _response = req.await.expect_err("should timeout on recv 1xx frame");
actix_rt::time::timeout(Duration::from_secs(15), req)
.await
.expect("request future stalled on recv 1xx frame")
.expect_err("should timeout on recv 1xx frame");
// assert_eq!(response.headers().get(&header), None);
let req = srv
.request(Method::GET, srv.surl(&format!("/{}", i)))
.send();
let _response = req.await.expect_err("should timeout on recv 1xx frame");
actix_rt::time::timeout(Duration::from_secs(15), req)
.await
.expect("request future stalled on recv 1xx frame")
.expect_err("should timeout on recv 1xx frame");
// assert_eq!(response.headers().get(&header), None);
}