From 15d1b09febcca1b9ba6f31074e68cf8da34694a3 Mon Sep 17 00:00:00 2001 From: katelyn martin Date: Sun, 1 Dec 2024 00:00:00 +0000 Subject: [PATCH] refactor(app/test): remove `connect_client(..)` and once more, we remove a helper function that isn't doing quite so much work, and whose signature contains deprecated hyper 1.0 types. Signed-off-by: katelyn martin --- linkerd/app/test/src/http_util.rs | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/linkerd/app/test/src/http_util.rs b/linkerd/app/test/src/http_util.rs index 2880302f18..cca25f412c 100644 --- a/linkerd/app/test/src/http_util.rs +++ b/linkerd/app/test/src/http_util.rs @@ -4,7 +4,6 @@ use crate::{ }; use futures::FutureExt; use hyper::{body::HttpBody, Body}; -use std::future::Future; use tokio::task::JoinSet; use tower::ServiceExt; use tracing::Instrument; @@ -30,7 +29,15 @@ pub async fn connect_and_accept( tracing::info!(?res, "proxy serve task complete"); res }; - let (client, client_bg) = connect_client(client_settings, client_io).await; + + let (client, conn) = client_settings + .handshake(client_io) + .await + .expect("Client must connect"); + let client_bg = conn.map(|res| { + tracing::info!(?res, "Client background complete"); + res.map_err(Error::from) + }); let mut bg = tokio::task::JoinSet::new(); bg.spawn( @@ -55,22 +62,6 @@ pub async fn connect_and_accept( (client, bg) } -#[allow(deprecated)] // linkerd/linkerd2#8733 -async fn connect_client( - client_settings: &mut ClientBuilder, - io: io::DuplexStream, -) -> (SendRequest, impl Future>) { - let (client, conn) = client_settings - .handshake(io) - .await - .expect("Client must connect"); - let client_bg = conn.map(|res| { - tracing::info!(?res, "Client background complete"); - res.map_err(Into::into) - }); - (client, client_bg) -} - /// Collects a request or response body, returning it as a [`String`]. pub async fn body_to_string(body: T) -> Result where