Skip to content

Commit 4c679ff

Browse files
committed
added test for failing non-blocking methods
1 parent 4fa9093 commit 4c679ff

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

aimdb-sync/tests/integration_test.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,24 @@ fn test_runtime_shutdown_error() {
244244
assert!(matches!(result, Err(SyncError::RuntimeShutdown)));
245245
}
246246

247+
/// Test error handling - runtime shutdown, non-blocking operations
248+
#[test]
249+
fn test_runtime_shutdown_error_non_blocking() {
250+
let (handle, producer, mut consumer) = setup(BufferCfg::SpmcRing { capacity: 10 });
251+
252+
// Shut down the runtime
253+
handle.detach().expect("Failed to detach");
254+
255+
// Non-blocking operations should now fail with RuntimeShutdown too
256+
let test_value = test_value();
257+
258+
let result = producer.try_set(test_value);
259+
assert!(matches!(result, Err(SyncError::RuntimeShutdown)));
260+
261+
let result = consumer.try_get();
262+
assert!(matches!(result, Err(SyncError::RuntimeShutdown)));
263+
}
264+
247265
/// Test error handling - reading messages sent before the shutdown
248266
#[test]
249267
fn test_runtime_shutdown_after_produce_read_error() {

0 commit comments

Comments
 (0)