Skip to content

Commit 393c5be

Browse files
committed
test(s2n-quic-dc): fix flaky UDP stream tests
1 parent c8de638 commit 393c5be

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

dc/s2n-quic-dc/src/stream/send/tests.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ async fn run(protocol: Protocol, buffer_len: usize, iterations: usize, features:
7979
let expected = buffer_len * iterations;
8080
println!("expected={expected}");
8181

82-
tokio::spawn(
82+
tokio::spawn({
83+
let client = client.clone();
84+
8385
async move {
8486
let mut stream = client.connect_to(&server_handle).await.unwrap();
8587
let mut total = 0;
@@ -97,12 +99,17 @@ async fn run(protocol: Protocol, buffer_len: usize, iterations: usize, features:
9799
let _ = stream.shutdown().await;
98100
}
99101
}
100-
.instrument(tracing::debug_span!("application")),
101-
);
102+
.instrument(tracing::debug_span!("client"))
103+
});
102104

103105
let actual = client_response.await.unwrap();
104106
assert_eq!(expected, actual);
105107

108+
tokio::time::sleep(core::time::Duration::from_secs(1)).await;
109+
110+
// make sure the client lives long enough to complete the streams
111+
drop(client);
112+
106113
// TODO make sure the worker shut down correctly
107114
//worker.await.unwrap();
108115
}
@@ -254,7 +261,6 @@ mod tcp {
254261
negative_suite!();
255262
}
256263

257-
#[cfg(todo)] // These tests are currently flaky
258264
mod udp {
259265
use super::*;
260266
const PROTOCOL: Protocol = Protocol::Udp;

dc/s2n-quic-dc/src/stream/testing.rs

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use tracing::Instrument;
1818

1919
type Subscriber = (Arc<event::testing::Subscriber>, event::tracing::Subscriber);
2020

21+
#[derive(Clone)]
2122
pub struct Client {
2223
map: secret::Map,
2324
env: env::Environment<Subscriber>,

0 commit comments

Comments
 (0)