diff --git a/native/local/src/handle.rs b/native/local/src/handle.rs index 9ca0dd20c23..7ef5ada4dd2 100644 --- a/native/local/src/handle.rs +++ b/native/local/src/handle.rs @@ -211,7 +211,14 @@ mod tests { let result = receiver.recv_timeout(Duration::from_secs(5)).unwrap(); assert!(result.err().unwrap().to_string().contains("cancelled")); assert!(started.elapsed() < Duration::from_secs(5)); - assert_eq!(refs.strong_count(), 0); + let releasing = Instant::now(); + while refs.strong_count() != 0 { + assert!( + releasing.elapsed() < Duration::from_secs(5), + "cancelled graph remained live" + ); + std::thread::yield_now(); + } thread.join().unwrap(); } } diff --git a/native/local/tests/execution.rs b/native/local/tests/execution.rs index 4cf4660b457..a6fbf153af8 100644 --- a/native/local/tests/execution.rs +++ b/native/local/tests/execution.rs @@ -477,7 +477,6 @@ async fn partition_order_cancel_releases_running_partitions() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn partition_order_runs_at_most_the_given_number_of_partitions() { let (plan, observations) = observe(ordered_input(6, 3)); - let executed = || observations.executions.lock().unwrap().clone(); let mut stream = LocalQuery::new(plan, context(), 2, usize::MAX) .execute() .unwrap(); @@ -490,7 +489,7 @@ async fn partition_order_runs_at_most_the_given_number_of_partitions() { .unwrap() .unwrap(); } - assert_eq!(executed(), vec![0, 1]); + assert_executed_once(&observations, 2); // Finishing the first partition starts the third. timeout(DEADLINE, stream.next()) .await