mirror of https://github.com/linkerd/linkerd2.git
proxy: fix tcp_with_no_orig_dst test (#229)
Sometimes, the try_read will return a connection error, sometimes it will just return EOF. Handle both cases. Closes #226
This commit is contained in:
parent
4a76c6448b
commit
9720a32de7
|
@ -227,7 +227,9 @@ fn inbound_tcp() {
|
|||
fn tcp_with_no_orig_dst() {
|
||||
let _ = env_logger::init();
|
||||
|
||||
let srv = server::tcp().run();
|
||||
let srv = server::tcp()
|
||||
.accept(move |_| "don't read me")
|
||||
.run();
|
||||
let ctrl = controller::new().run();
|
||||
let proxy = proxy::new()
|
||||
.controller(ctrl)
|
||||
|
@ -240,7 +242,11 @@ fn tcp_with_no_orig_dst() {
|
|||
let tcp_client = client.connect();
|
||||
tcp_client.write("custom tcp hello");
|
||||
|
||||
assert!(tcp_client.try_read().is_err());
|
||||
let read = tcp_client
|
||||
.try_read()
|
||||
// This read might be an error, or an empty vec
|
||||
.unwrap_or_else(|_| Vec::new());
|
||||
assert_eq!(read, b"");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in New Issue