Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,7 @@ dependencies = [
"linkerd-app-admin",
"linkerd-app-core",
"linkerd-app-test",
"linkerd-http-body-compat",
"linkerd-meshtls",
"linkerd-metrics",
"linkerd-tracing",
Expand Down
1 change: 1 addition & 0 deletions linkerd/app/integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ flate2 = { version = "1", default-features = false, features = [
] }
# Log streaming isn't enabled by default globally, but we want to test it.
linkerd-app-admin = { path = "../admin", features = ["log-streaming"] }
linkerd-http-body-compat = { path = "../../http/body-compat" }
# No code from this crate is actually used; only necessary to enable the Rustls
# implementation.
linkerd-meshtls = { path = "../../meshtls", features = ["rustls"] }
Expand Down
45 changes: 34 additions & 11 deletions linkerd/app/integration/src/tests/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,9 @@ mod grpc_retry {
assert_eq!(res.status(), 200);
assert_eq!(res.headers().get(&GRPC_STATUS), None);

let mut body = res.into_body();
let mut body = res
.map(linkerd_http_body_compat::ForwardCompatibleBody::new)
.into_body();
let trailers = trailers(&mut body).await;
assert_eq!(trailers.get(&GRPC_STATUS), Some(&GRPC_STATUS_OK));
assert_eq!(retries.load(Ordering::Relaxed), 2);
Expand Down Expand Up @@ -726,7 +728,9 @@ mod grpc_retry {
assert_eq!(res.status(), 200);
assert_eq!(res.headers().get(&GRPC_STATUS), None);

let mut body = res.into_body();
let mut body = res
.map(linkerd_http_body_compat::ForwardCompatibleBody::new)
.into_body();

let data = data(&mut body).await;
assert_eq!(data, Bytes::from("hello world"));
Expand Down Expand Up @@ -777,7 +781,9 @@ mod grpc_retry {
assert_eq!(res.status(), 200);
assert_eq!(res.headers().get(&GRPC_STATUS), None);

let mut body = res.into_body();
let mut body = res
.map(linkerd_http_body_compat::ForwardCompatibleBody::new)
.into_body();

let frame1 = data(&mut body).await;
assert_eq!(frame1, Bytes::from("hello"));
Expand All @@ -790,21 +796,38 @@ mod grpc_retry {
assert_eq!(retries.load(Ordering::Relaxed), 1);
}

async fn data(body: &mut hyper::Body) -> Bytes {
async fn data<B>(body: &mut linkerd_http_body_compat::ForwardCompatibleBody<B>) -> B::Data
where
B: http_body::Body + Unpin,
B::Data: std::fmt::Debug,
B::Error: std::fmt::Debug,
{
let data = body
.data()
.frame()
.await
.expect("body data frame must not be eaten")
.unwrap();
.expect("a result")
.expect("a frame")
.into_data()
.expect("a chunk of data");
tracing::info!(?data);
data
}
async fn trailers(body: &mut hyper::Body) -> http::HeaderMap {

async fn trailers<B>(
body: &mut linkerd_http_body_compat::ForwardCompatibleBody<B>,
) -> http::HeaderMap
where
B: http_body::Body + Unpin,
B::Error: std::fmt::Debug,
{
let trailers = body
.trailers()
.frame()
.await
.expect("trailers future should not fail")
.expect("response should have trailers");
.expect("a result")
.expect("a frame")
.into_trailers()
.ok()
.expect("a trailers frame");
tracing::info!(?trailers);
trailers
}
Expand Down
Loading