Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(s2n-quic-dc): fix flaky UDP stream tests #2528

Merged
merged 1 commit into from
Mar 12, 2025
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
14 changes: 10 additions & 4 deletions dc/s2n-quic-dc/src/stream/send/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ async fn run(protocol: Protocol, buffer_len: usize, iterations: usize, features:
let expected = buffer_len * iterations;
println!("expected={expected}");

tokio::spawn(
tokio::spawn({
let client = client.clone();

async move {
let mut stream = client.connect_to(&server_handle).await.unwrap();
let mut total = 0;
Expand All @@ -97,12 +99,17 @@ async fn run(protocol: Protocol, buffer_len: usize, iterations: usize, features:
let _ = stream.shutdown().await;
}
}
.instrument(tracing::debug_span!("application")),
);
.instrument(tracing::debug_span!("client"))
});

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

tokio::time::sleep(core::time::Duration::from_secs(1)).await;

// make sure the client lives long enough to complete the streams
drop(client);

// TODO make sure the worker shut down correctly
//worker.await.unwrap();
}
Expand Down Expand Up @@ -254,7 +261,6 @@ mod tcp {
negative_suite!();
}

#[cfg(todo)] // These tests are currently flaky
mod udp {
use super::*;
const PROTOCOL: Protocol = Protocol::Udp;
Expand Down
1 change: 1 addition & 0 deletions dc/s2n-quic-dc/src/stream/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use tracing::Instrument;

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

#[derive(Clone)]
pub struct Client {
map: secret::Map,
env: env::Environment<Subscriber>,
Expand Down
Loading