RpcClient: wait_for_any, collect_events, call_and_wait #7
Labels
No labels
area:assertions
area:cli
area:client
area:harness
area:meta
area:reporting
area:runner
type:user-story
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/ws-rpc-test#7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User story
As a test author, I want convenience helpers for "wait until done or failed", "collect a stream of progress events", and "send a request and atomically wait for its follow-up event without race", so that the most common test patterns are one-liners.
Acceptance criteria
wait_for_any
wait_for_any(methods: &[&str], predicate: F, timeout: Duration) -> Result<(String, Value), TestError>whereF: Fn(&str, &Value) -> bool + Send + Sync.(matched_method, params).wait_for.TestError::Timeout { event: methods.join("|"), duration }.collect_events
collect_events(method: &str, duration: Duration) -> Vec<Value>.durationelapses.call_and_wait
event_methodbefore the call is sent, so that an event emitted in response to the call cannot be missed even if it arrives before the call response.(call_result, event_params).General
&selfand are usable from cloned client handles.References