Skip to content

Commit 57e843f

Browse files
Merge pull request #677 from swimos/circ-fix
Fixes faulty test logic for the circular buffer channel.
2 parents 73f7316 + b6b8759 commit 57e843f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

swimos_utilities/swimos_sync/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ swimos_num = { workspace = true }
1616

1717
[dev-dependencies]
1818
futures = { workspace = true }
19-
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
19+
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "sync"] }

swimos_utilities/swimos_sync/src/circular_buffer/tests.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
use crate::circular_buffer::error::{RecvError, SendError};
1616
use crate::circular_buffer::{InternalQueue, OneItemQueue, LARGE_BOUNDARY};
17+
use futures::future::join;
1718
use futures::task::ArcWake;
1819
use futures::StreamExt;
1920
use std::future::Future;
@@ -183,6 +184,7 @@ async fn receive_several_stream(n: usize) {
183184
for i in 0..n {
184185
assert!(tx.try_send(i).is_ok());
185186
}
187+
tx
186188
};
187189

188190
let recv_task = async move {
@@ -194,8 +196,9 @@ async fn receive_several_stream(n: usize) {
194196
let send_handle = tokio::spawn(send_task);
195197
let recv_handle = tokio::spawn(recv_task);
196198

197-
assert!(send_handle.await.is_ok());
198-
assert!(recv_handle.await.is_ok());
199+
let (send_result, recv_result) = join(send_handle, recv_handle).await;
200+
assert!(send_result.is_ok());
201+
assert!(recv_result.is_ok());
199202
}
200203

201204
#[tokio::test(flavor = "multi_thread")]
@@ -204,8 +207,6 @@ async fn small_receive_several_stream() {
204207
}
205208

206209
#[tokio::test(flavor = "multi_thread")]
207-
#[ignore]
208-
// todo: spuriously failing on CI
209210
async fn large_receive_several_stream() {
210211
receive_several_stream(LARGE_BOUNDARY + 1).await;
211212
}

0 commit comments

Comments
 (0)