Skip to content

Commit da14466

Browse files
authored
Split orig-proto tests out of discovery tests (#629)
About 18 months ago, we removed support for a variety of headers that could potentially leak information to external clients and services; but the implementation and tests remain in place. In the interest of removing cruft, this change removes these unused modules (which are not compiled, and may therefore not even compile today). These headers are: `l5d-client-id`, `l5d-server-id`, and `l5d-remote-ip`.
1 parent e062214 commit da14466

File tree

2 files changed

+84
-84
lines changed

2 files changed

+84
-84
lines changed

linkerd/app/integration/tests/discovery.rs

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -626,87 +626,3 @@ mod http1 {
626626
}
627627
}
628628
}
629-
630-
mod proxy_to_proxy {
631-
use super::*;
632-
633-
#[tokio::test]
634-
async fn outbound_http1() {
635-
let _trace = trace_init();
636-
637-
// Instead of a second proxy, this mocked h2 server will be the target.
638-
let srv = server::http2()
639-
.route_fn("/hint", |req| {
640-
assert_eq!(req.headers()["l5d-orig-proto"], "HTTP/1.1");
641-
Response::builder()
642-
.header("l5d-orig-proto", "HTTP/1.1")
643-
.body(Default::default())
644-
.unwrap()
645-
})
646-
.run()
647-
.await;
648-
649-
let ctrl = controller::new();
650-
ctrl.profile_tx_default("disco.test.svc.cluster.local");
651-
let dst = ctrl.destination_tx("disco.test.svc.cluster.local");
652-
dst.send_h2_hinted(srv.addr);
653-
654-
let proxy = proxy::new().controller(ctrl.run().await).run().await;
655-
656-
let client = client::http1(proxy.outbound, "disco.test.svc.cluster.local");
657-
658-
let res = client
659-
.request(client.request_builder("/hint"))
660-
.await
661-
.unwrap();
662-
assert_eq!(res.status(), 200);
663-
assert_eq!(res.version(), http::Version::HTTP_11);
664-
665-
// Ensure panics are propagated.
666-
proxy.join_servers().await;
667-
srv.join().await;
668-
}
669-
670-
#[tokio::test]
671-
async fn inbound_http1() {
672-
let _trace = trace_init();
673-
674-
let srv = server::http1()
675-
.route_fn("/h1", |req| {
676-
assert_eq!(req.version(), http::Version::HTTP_11);
677-
assert!(
678-
!req.headers().contains_key("l5d-orig-proto"),
679-
"h1 server shouldn't receive l5d-orig-proto header"
680-
);
681-
Response::default()
682-
})
683-
.run()
684-
.await;
685-
686-
let ctrl = controller::new();
687-
ctrl.profile_tx_default("disco.test.svc.cluster.local");
688-
689-
let proxy = proxy::new()
690-
.controller(ctrl.run().await)
691-
.inbound(srv)
692-
.run()
693-
.await;
694-
695-
// This client will be used as a mocked-other-proxy.
696-
let client = client::http2(proxy.inbound, "disco.test.svc.cluster.local");
697-
698-
let res = client
699-
.request(
700-
client
701-
.request_builder("/h1")
702-
.header("l5d-orig-proto", "HTTP/1.1"),
703-
)
704-
.await
705-
.unwrap();
706-
assert_eq!(res.status(), 200);
707-
assert_eq!(res.version(), http::Version::HTTP_2);
708-
709-
// Ensure panics are propagated.
710-
proxy.join_servers().await;
711-
}
712-
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#![deny(warnings, rust_2018_idioms)]
2+
#![type_length_limit = "3361329"]
3+
4+
use linkerd2_app_integration::*;
5+
6+
#[tokio::test]
7+
async fn outbound_http1() {
8+
let _trace = trace_init();
9+
10+
// Instead of a second proxy, this mocked h2 server will be the target.
11+
let srv = server::http2()
12+
.route_fn("/hint", |req| {
13+
assert_eq!(req.headers()["l5d-orig-proto"], "HTTP/1.1");
14+
Response::builder()
15+
.header("l5d-orig-proto", "HTTP/1.1")
16+
.body(Default::default())
17+
.unwrap()
18+
})
19+
.run()
20+
.await;
21+
22+
let ctrl = controller::new();
23+
ctrl.profile_tx_default("disco.test.svc.cluster.local");
24+
let dst = ctrl.destination_tx("disco.test.svc.cluster.local");
25+
dst.send_h2_hinted(srv.addr);
26+
27+
let proxy = proxy::new().controller(ctrl.run().await).run().await;
28+
29+
let client = client::http1(proxy.outbound, "disco.test.svc.cluster.local");
30+
31+
let res = client
32+
.request(client.request_builder("/hint"))
33+
.await
34+
.unwrap();
35+
assert_eq!(res.status(), 200);
36+
assert_eq!(res.version(), http::Version::HTTP_11);
37+
38+
// Ensure panics are propagated.
39+
proxy.join_servers().await;
40+
srv.join().await;
41+
}
42+
43+
#[tokio::test]
44+
async fn inbound_http1() {
45+
let _trace = trace_init();
46+
47+
let srv = server::http1()
48+
.route_fn("/h1", |req| {
49+
assert_eq!(req.version(), http::Version::HTTP_11);
50+
assert!(
51+
!req.headers().contains_key("l5d-orig-proto"),
52+
"h1 server shouldn't receive l5d-orig-proto header"
53+
);
54+
Response::default()
55+
})
56+
.run()
57+
.await;
58+
59+
let ctrl = controller::new();
60+
ctrl.profile_tx_default("disco.test.svc.cluster.local");
61+
62+
let proxy = proxy::new()
63+
.controller(ctrl.run().await)
64+
.inbound(srv)
65+
.run()
66+
.await;
67+
68+
// This client will be used as a mocked-other-proxy.
69+
let client = client::http2(proxy.inbound, "disco.test.svc.cluster.local");
70+
71+
let res = client
72+
.request(
73+
client
74+
.request_builder("/h1")
75+
.header("l5d-orig-proto", "HTTP/1.1"),
76+
)
77+
.await
78+
.unwrap();
79+
assert_eq!(res.status(), 200);
80+
assert_eq!(res.version(), http::Version::HTTP_2);
81+
82+
// Ensure panics are propagated.
83+
proxy.join_servers().await;
84+
}

0 commit comments

Comments
 (0)