1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-26 15:07:42 +02:00

Update tests

This commit is contained in:
Yuki Okushi
2020-03-08 16:42:45 +09:00
parent a9a475d555
commit e718f65121
12 changed files with 151 additions and 87 deletions

View File

@ -107,17 +107,15 @@ async fn test_form() {
#[actix_rt::test]
async fn test_timeout() {
let srv = test::start(|| {
App::new().service(web::resource("/").route(web::to(|| {
async {
actix_rt::time::delay_for(Duration::from_millis(200)).await;
Ok::<_, Error>(HttpResponse::Ok().body(STR))
}
App::new().service(web::resource("/").route(web::to(|| async {
actix_rt::time::delay_for(Duration::from_millis(200)).await;
Ok::<_, Error>(HttpResponse::Ok().body(STR))
})))
});
let connector = awc::Connector::new()
.connector(actix_connect::new_connector(
actix_connect::start_default_resolver(),
actix_connect::start_default_resolver().await.unwrap(),
))
.timeout(Duration::from_secs(15))
.finish();
@ -137,11 +135,9 @@ async fn test_timeout() {
#[actix_rt::test]
async fn test_timeout_override() {
let srv = test::start(|| {
App::new().service(web::resource("/").route(web::to(|| {
async {
actix_rt::time::delay_for(Duration::from_millis(200)).await;
Ok::<_, Error>(HttpResponse::Ok().body(STR))
}
App::new().service(web::resource("/").route(web::to(|| async {
actix_rt::time::delay_for(Duration::from_millis(200)).await;
Ok::<_, Error>(HttpResponse::Ok().body(STR))
})))
});
@ -177,7 +173,8 @@ async fn test_connection_reuse() {
))
.tcp(),
)
});
})
.await;
let client = awc::Client::default();
@ -214,7 +211,8 @@ async fn test_connection_force_close() {
))
.tcp(),
)
});
})
.await;
let client = awc::Client::default();
@ -253,7 +251,8 @@ async fn test_connection_server_close() {
))
.tcp(),
)
});
})
.await;
let client = awc::Client::default();
@ -291,7 +290,8 @@ async fn test_connection_wait_queue() {
))
.tcp(),
)
});
})
.await;
let client = awc::Client::build()
.connector(awc::Connector::new().limit(1).finish())
@ -339,7 +339,8 @@ async fn test_connection_wait_queue_force_close() {
))
.tcp(),
)
});
})
.await;
let client = awc::Client::build()
.connector(awc::Connector::new().limit(1).finish())