Repository: swimos/swim-rust (language: rust)

Issue:
circular_buffer:: large_receive_several_stream spuriously failing
https://github.com/swimos/swim-rust/blob/main/swimos_utilities/swimos_sync/src/circular_buffer/tests.rs#L207

Backtrace:
```
---- circular_buffer::tests::large_receive_several_stream stdout ----
thread 'tokio-runtime-worker' panicked at swimos_utilities\swimos_sync\src\circular_buffer\tests.rs:190:13:
assertion `left == right` failed
  left: None
 right: Some(1)
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:645
   1: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:72
   2: core::panicking::assert_failed_inner
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:343
   3: core::panicking::assert_failed<enum2$<core::option::Option<usize> >,enum2$<core::option::Option<usize> > >
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\panicking.rs:298
   4: swimos_sync::circular_buffer::tests::receive_several_stream::async_fn$0::async_block$1
             at .\src\circular_buffer\tests.rs:190

```


Discussion / hints:

Fix patch:
diff --git a/swimos_utilities/swimos_sync/Cargo.toml b/swimos_utilities/swimos_sync/Cargo.toml
index 64fda1b68..24495b040 100644
--- a/swimos_utilities/swimos_sync/Cargo.toml
+++ b/swimos_utilities/swimos_sync/Cargo.toml
@@ -16,4 +16,4 @@ swimos_num = { workspace = true }
 
 [dev-dependencies]
 futures = { workspace = true }
-tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
+tokio = { workspace = true, features = ["rt-multi-thread", "macros", "sync"] }


Test patch:
diff --git a/swimos_utilities/swimos_sync/src/circular_buffer/tests.rs b/swimos_utilities/swimos_sync/src/circular_buffer/tests.rs
index 1d2f9ddc3..854ba724f 100644
--- a/swimos_utilities/swimos_sync/src/circular_buffer/tests.rs
+++ b/swimos_utilities/swimos_sync/src/circular_buffer/tests.rs
@@ -14,6 +14,7 @@
 
 use crate::circular_buffer::error::{RecvError, SendError};
 use crate::circular_buffer::{InternalQueue, OneItemQueue, LARGE_BOUNDARY};
+use futures::future::join;
 use futures::task::ArcWake;
 use futures::StreamExt;
 use std::future::Future;
@@ -183,6 +184,7 @@ async fn receive_several_stream(n: usize) {
         for i in 0..n {
             assert!(tx.try_send(i).is_ok());
         }
+        tx
     };
 
     let recv_task = async move {
@@ -194,8 +196,9 @@ async fn receive_several_stream(n: usize) {
     let send_handle = tokio::spawn(send_task);
     let recv_handle = tokio::spawn(recv_task);
 
-    assert!(send_handle.await.is_ok());
-    assert!(recv_handle.await.is_ok());
+    let (send_result, recv_result) = join(send_handle, recv_handle).await;
+    assert!(send_result.is_ok());
+    assert!(recv_result.is_ok());
 }
 
 #[tokio::test(flavor = "multi_thread")]
@@ -204,8 +207,6 @@ async fn small_receive_several_stream() {
 }
 
 #[tokio::test(flavor = "multi_thread")]
-#[ignore]
-// todo: spuriously failing on CI
 async fn large_receive_several_stream() {
     receive_several_stream(LARGE_BOUNDARY + 1).await;
 }