1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-28 07:30:36 +02:00

update tests

This commit is contained in:
Nikolay Kim
2019-12-02 11:43:52 +06:00
parent d81e72cf06
commit a08b1eba87
9 changed files with 37 additions and 83 deletions

View File

@ -42,7 +42,6 @@ either = "1.5.2"
futures = "0.3.1"
http = { version = "0.1.17", optional = true }
log = "0.4"
tokio-net = "=0.2.0-alpha.6"
trust-dns-resolver = { version="0.18.0-alpha.1", default-features = false }
# openssl
@ -58,4 +57,3 @@ webpki = { version = "0.21", optional = true }
[dev-dependencies]
bytes = "0.4"
actix-testing = { version="0.3.0-alpha.1" }
actix-server-config = "0.3.0-alpha.1"

View File

@ -6,9 +6,9 @@ use std::net::SocketAddr;
use std::pin::Pin;
use std::task::{Context, Poll};
use actix_rt::net::TcpStream;
use actix_service::{Service, ServiceFactory};
use futures::future::{err, ok, BoxFuture, Either, FutureExt, Ready};
use tokio_net::tcp::TcpStream;
use super::connect::{Address, Connect, Connection};
use super::error::ConnectError;

View File

@ -20,9 +20,8 @@ pub mod ssl;
#[cfg(feature = "uri")]
mod uri;
use actix_rt::Arbiter;
use actix_rt::{net::TcpStream, Arbiter};
use actix_service::{pipeline, pipeline_factory, Service, ServiceFactory};
use tokio_net::tcp::TcpStream;
pub use trust_dns_resolver::config::{ResolverConfig, ResolverOpts};
pub use trust_dns_resolver::system_conf::read_system_conf;

View File

@ -2,10 +2,10 @@ use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use actix_rt::net::TcpStream;
use actix_service::{Service, ServiceFactory};
use either::Either;
use futures::future::{ok, Ready};
use tokio_net::tcp::TcpStream;
use trust_dns_resolver::AsyncResolver;
use crate::connect::{Address, Connect, Connection};

View File

@ -1,7 +1,7 @@
use std::io;
use actix_codec::{BytesCodec, Framed};
use actix_server_config::Io;
use actix_rt::net::TcpStream;
use actix_service::{service_fn, Service, ServiceFactory};
use actix_testing::TestServer;
use bytes::Bytes;
@ -14,9 +14,9 @@ use actix_connect::Connect;
#[actix_rt::test]
async fn test_string() {
let srv = TestServer::with(|| {
service_fn(|io: Io<tokio_net::tcp::TcpStream>| {
service_fn(|io: TcpStream| {
async {
let mut framed = Framed::new(io.into_parts().0, BytesCodec);
let mut framed = Framed::new(io, BytesCodec);
framed.send(Bytes::from_static(b"test")).await?;
Ok::<_, io::Error>(())
}
@ -33,9 +33,9 @@ async fn test_string() {
#[actix_rt::test]
async fn test_rustls_string() {
let srv = TestServer::with(|| {
service_fn(|io: Io<tokio_net::tcp::TcpStream>| {
service_fn(|io: TcpStream| {
async {
let mut framed = Framed::new(io.into_parts().0, BytesCodec);
let mut framed = Framed::new(io, BytesCodec);
framed.send(Bytes::from_static(b"test")).await?;
Ok::<_, io::Error>(())
}
@ -51,9 +51,9 @@ async fn test_rustls_string() {
#[actix_rt::test]
async fn test_static_str() {
let srv = TestServer::with(|| {
service_fn(|io: Io<tokio_net::tcp::TcpStream>| {
service_fn(|io: TcpStream| {
async {
let mut framed = Framed::new(io.into_parts().0, BytesCodec);
let mut framed = Framed::new(io, BytesCodec);
framed.send(Bytes::from_static(b"test")).await?;
Ok::<_, io::Error>(())
}
@ -75,9 +75,9 @@ async fn test_static_str() {
#[actix_rt::test]
async fn test_new_service() {
let srv = TestServer::with(|| {
service_fn(|io: Io<tokio_net::tcp::TcpStream>| {
service_fn(|io: TcpStream| {
async {
let mut framed = Framed::new(io.into_parts().0, BytesCodec);
let mut framed = Framed::new(io, BytesCodec);
framed.send(Bytes::from_static(b"test")).await?;
Ok::<_, io::Error>(())
}
@ -100,9 +100,9 @@ async fn test_uri() {
use http::HttpTryFrom;
let srv = TestServer::with(|| {
service_fn(|io: Io<tokio_net::tcp::TcpStream>| {
service_fn(|io: TcpStream| {
async {
let mut framed = Framed::new(io.into_parts().0, BytesCodec);
let mut framed = Framed::new(io, BytesCodec);
framed.send(Bytes::from_static(b"test")).await?;
Ok::<_, io::Error>(())
}
@ -121,9 +121,9 @@ async fn test_rustls_uri() {
use http::HttpTryFrom;
let srv = TestServer::with(|| {
service_fn(|io: Io<tokio_net::tcp::TcpStream>| {
service_fn(|io: TcpStream| {
async {
let mut framed = Framed::new(io.into_parts().0, BytesCodec);
let mut framed = Framed::new(io, BytesCodec);
framed.send(Bytes::from_static(b"test")).await?;
Ok::<_, io::Error>(())
}