add sync API characterization tests - #211
Conversation
|
@lxsaah Hi, I'm sorry that it took this long for me to do the work. Been extremely busy with my full-time work. I am waiting for your review, thanks!! |
@harunugurlu, don't worry. Thanks a lot for your contribution! I'll have a look as soon as #208 lands. Meanwhile please ensure the the workflows are running successfully. |
lxsaah
left a comment
There was a problem hiding this comment.
The rest holds up, the mpsc handshake is the right answer to the issue's "no sleep-and-hope" constraint. It also passes unmodified against pre-#208, which makes it evidence the rewrite preserved the blocking semantics. Happy to approve once the two items are in.
| }); | ||
|
|
||
| // Join producer thread | ||
| producer_handle.join().unwrap(); |
There was a problem hiding this comment.
The producer thread is joined before the consumer thread is spawned, so all ten values are already buffered and every get() returns immediately. Issue #198 asks for ordering and no-loss on the blocking path. Let's spawn the consumer first and produce afterwards, using the same ready-signal handshake as the other tests.
| .expect("Failed to create consumer"); | ||
|
|
||
| // Create consumer thread and try get the value | ||
| let consumer_no_val_handler = thread::spawn(move || consumer_no_val.try_get()); |
There was a problem hiding this comment.
Both halves of test_consumer_try_get only check the returned value, so a try_get that regressed into get_with_timeout(Duration::from_secs(5)) would still pass. Wrap the empty-buffer call in Instant::now() and assert a loose upper bound (~250 ms) to pin the property the issue actually names.
Summary
get()wake-up behaviorget_with_timeout()behaviortry_get()behaviorRuntimeShutdownduring detachVerification
cargo fmt --all -- --checkcargo clippy --package aimdb-sync --all-targets -- -D warningscargo test -p aimdb-syncmake checkCloses #198