1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-30 18:44:35 +01:00

add test with custom connector

This commit is contained in:
Nikolay Kim 2019-11-21 17:36:18 +06:00
parent 1f0577f8d5
commit 0b9e3d381b
2 changed files with 10 additions and 0 deletions

View File

@ -63,6 +63,7 @@ rust-tls = { version = "0.16.0", package="rustls", optional = true, features = [
[dev-dependencies] [dev-dependencies]
actix-rt = "1.0.0-alpha.1" actix-rt = "1.0.0-alpha.1"
actix-connect = { version = "1.0.0-alpha.1", features=["openssl"] }
actix-web = { version = "2.0.0-alpha.1", features=["openssl"] } actix-web = { version = "2.0.0-alpha.1", features=["openssl"] }
actix-http = { version = "0.3.0-alpha.1", features=["openssl"] } actix-http = { version = "0.3.0-alpha.1", features=["openssl"] }
actix-http-test = { version = "0.3.0-alpha.1", features=["openssl"] } actix-http-test = { version = "0.3.0-alpha.1", features=["openssl"] }

View File

@ -125,9 +125,18 @@ fn test_timeout() {
))) )))
}); });
let connector = awc::Connector::new()
.connector(actix_connect::new_connector(
actix_connect::start_default_resolver(),
))
.timeout(Duration::from_secs(15))
.finish();
let client = awc::Client::build() let client = awc::Client::build()
.connector(connector)
.timeout(Duration::from_millis(50)) .timeout(Duration::from_millis(50))
.finish(); .finish();
let request = client.get(srv.url("/")).send(); let request = client.get(srv.url("/")).send();
match request.await { match request.await {
Err(SendRequestError::Timeout) => (), Err(SendRequestError::Timeout) => (),