From ca982b246753f05671f38ad829746150121a5df1 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Wed, 25 Sep 2019 10:00:54 +0600 Subject: [PATCH] update workspace deps for tests --- Cargo.toml | 13 +++++++++++++ actix-connect/tests/test_connect.rs | 19 ++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 02bd2166..60443fe0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,3 +39,16 @@ futures = "0.1.25" openssl = "0.10" tokio-tcp = "0.1" tokio-openssl = "0.3" + +[patch.crates-io] +actix-codec = { path = "actix-codec" } +actix-connect = { path = "actix-connect" } +actix-ioframe = { path = "actix-ioframe" } +actix-rt = { path = "actix-rt" } +actix-server = { path = "actix-server" } +actix-server-config = { path = "actix-server-config" } +actix-service = { path = "actix-service" } +actix-testing = { path = "actix-testing" } +actix-threadpool = { path = "actix-threadpool" } +actix-utils = { path = "actix-utils" } +actix-router = { path = "router" } diff --git a/actix-connect/tests/test_connect.rs b/actix-connect/tests/test_connect.rs index 0de0cf90..a8fdb1b6 100644 --- a/actix-connect/tests/test_connect.rs +++ b/actix-connect/tests/test_connect.rs @@ -4,14 +4,15 @@ use actix_service::{service_fn, NewService, Service}; use actix_testing::{self as test, TestServer}; use bytes::Bytes; use futures::{future::lazy, Future, Sink}; +use http::{HttpTryFrom, Uri}; use trust_dns_resolver::config::{ResolverConfig, ResolverOpts}; -use actix_connect::Connect; +use actix_connect::{default_connector, Connect}; #[cfg(feature = "ssl")] #[test] fn test_string() { - let mut srv = TestServer::with(|| { + let srv = TestServer::with(|| { service_fn(|io: Io| { Framed::new(io.into_parts().0, BytesCodec) .send(Bytes::from_static(b"test")) @@ -21,14 +22,14 @@ fn test_string() { let mut conn = default_connector(); let addr = format!("localhost:{}", srv.port()); - let con = srv.run_on(move || conn.call(addr.into())).unwrap(); + let con = test::call_service(&mut conn, addr.into()); assert_eq!(con.peer_addr().unwrap(), srv.addr()); } #[cfg(feature = "rust-tls")] #[test] fn test_rustls_string() { - let mut srv = TestServer::with(|| { + let srv = TestServer::with(|| { service_fn(|io: Io| { Framed::new(io.into_parts().0, BytesCodec) .send(Bytes::from_static(b"test")) @@ -38,7 +39,7 @@ fn test_rustls_string() { let mut conn = default_connector(); let addr = format!("localhost:{}", srv.port()); - let con = srv.run_on(move || conn.call(addr.into())).unwrap(); + let con = test::call_service(&mut conn, addr.into()); assert_eq!(con.peer_addr().unwrap(), srv.addr()); } #[test] @@ -101,7 +102,7 @@ fn test_new_service() { #[cfg(feature = "ssl")] #[test] fn test_uri() { - let mut srv = TestServer::with(|| { + let srv = TestServer::with(|| { service_fn(|io: Io| { Framed::new(io.into_parts().0, BytesCodec) .send(Bytes::from_static(b"test")) @@ -111,14 +112,14 @@ fn test_uri() { let mut conn = default_connector(); let addr = Uri::try_from(format!("https://localhost:{}", srv.port())).unwrap(); - let con = test::run_on(move || conn.call(addr.into())).unwrap(); + let con = test::call_service(&mut conn, addr.into()); assert_eq!(con.peer_addr().unwrap(), srv.addr()); } #[cfg(feature = "rust-tls")] #[test] fn test_rustls_uri() { - let mut srv = TestServer::with(|| { + let srv = TestServer::with(|| { service_fn(|io: Io| { Framed::new(io.into_parts().0, BytesCodec) .send(Bytes::from_static(b"test")) @@ -128,6 +129,6 @@ fn test_rustls_uri() { let mut conn = default_connector(); let addr = Uri::try_from(format!("https://localhost:{}", srv.port())).unwrap(); - let con = test::run_on(move || conn.call(addr.into())).unwrap(); + let con = test::call_service(&mut conn, addr.into()); assert_eq!(con.peer_addr().unwrap(), srv.addr()); }