Skip to content

Commit

Permalink
Fix all rustls and openssl tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abs0luty committed Dec 22, 2023
1 parent 86f4294 commit 0e5a427
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
28 changes: 10 additions & 18 deletions src/tls_openssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,16 @@ mod tests {
handle::Handle,
tls_openssl::{self, OpenSSLConfig},
};
use axum::{routing::get, Router};
use axum::body::Body;
use axum::routing::get;
use axum::Router;
use bytes::Bytes;
use http::{response, Request};
use hyper::{
client::conn::{handshake, SendRequest},
Body,
};
use http_body_util::BodyExt;
use hyper::client::conn::http1::{handshake, SendRequest};
use hyper_util::rt::TokioIo;
use std::{io, net::SocketAddr, time::Duration};
use tokio::{net::TcpStream, task::JoinHandle, time::timeout};
use tower::{Service, ServiceExt};

use openssl::{
ssl::{Ssl, SslConnector, SslMethod, SslVerifyMode},
Expand Down Expand Up @@ -415,12 +415,7 @@ mod tests {

handle.shutdown();

let response_future_result = client
.ready()
.await
.unwrap()
.call(Request::new(Body::empty()))
.await;
let response_future_result = client.send_request(Request::new(Body::empty())).await;

assert!(response_future_result.is_err());

Expand Down Expand Up @@ -512,7 +507,7 @@ mod tests {

async fn connect(addr: SocketAddr) -> (SendRequest<Body>, JoinHandle<()>) {
let stream = TcpStream::connect(addr).await.unwrap();
let tls_stream = tls_connector(dns_name(), stream).await;
let tls_stream = TokioIo::new(tls_connector(dns_name(), stream).await);

let (send_request, connection) = handshake(tls_stream).await.unwrap();

Expand All @@ -525,14 +520,11 @@ mod tests {

async fn send_empty_request(client: &mut SendRequest<Body>) -> (response::Parts, Bytes) {
let (parts, body) = client
.ready()
.await
.unwrap()
.call(Request::new(Body::empty()))
.send_request(Request::new(Body::empty()))
.await
.unwrap()
.into_parts();
let body = hyper::body::to_bytes(body).await.unwrap();
let body = body.collect().await.unwrap().to_bytes();

(parts, body)
}
Expand Down
6 changes: 2 additions & 4 deletions src/tls_rustls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ async fn config_from_pem_chain_file(
mod tests {
use crate::handle::Handle;
use crate::tls_rustls::{self, RustlsConfig};
use axum::body::Body;
use axum::routing::get;
use axum::Router;
use axum::body::Body;
use bytes::Bytes;
use http::{response, Request};
use http_body_util::BodyExt;
Expand Down Expand Up @@ -469,9 +469,7 @@ mod tests {

handle.shutdown();

let response_future_result = client
.send_request(Request::new(Body::empty()))
.await;
let response_future_result = client.send_request(Request::new(Body::empty())).await;

assert!(response_future_result.is_err());

Expand Down

0 comments on commit 0e5a427

Please sign in to comment.