Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
Merged
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
7 changes: 7 additions & 0 deletions src/tests/connection_termination_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,16 @@ async fn test_close_delivers_pending_messages() {

// Should receive Closed event after all messages are delivered
let mut sent_count = 0;
let mut received_count = 0;
loop {
match conn.next_event().await {
Some(ConnectionEvent::Sent { .. }) => {
sent_count += 1;
}
Some(ConnectionEvent::Received { .. }) => {
// Echo server may send back messages before close completes
received_count += 1;
}
Some(ConnectionEvent::Closed) => {
break;
}
Expand All @@ -144,6 +149,8 @@ async fn test_close_delivers_pending_messages() {

// Should have sent all messages before closing
assert_eq!(sent_count, 5);
// May have received some or all echoed messages
assert!(received_count <= 5);
})
.await
.expect("Test should complete within timeout");
Expand Down
Loading