Use wait_for_event helpers in tests (#4753)
## Summary - replace manual event polling loops in several core test suites with the shared wait_for_event helpers - keep prior assertions intact by using closure captures for stateful expectations, including plan updates, patch lifecycles, and review flow checks - rely on wait_for_event_with_timeout where longer waits are required, simplifying timeout handling ## Testing - just fmt ------ https://chatgpt.com/codex/tasks/task_i_68e1d58582d483208febadc5f90dd95e
This commit is contained in:
@@ -19,6 +19,7 @@ use core_test_support::skip_if_no_network;
|
||||
use core_test_support::skip_if_sandbox;
|
||||
use core_test_support::test_codex::TestCodex;
|
||||
use core_test_support::test_codex::test_codex;
|
||||
use core_test_support::wait_for_event;
|
||||
use serde_json::Value;
|
||||
|
||||
fn extract_output_text(item: &Value) -> Option<&str> {
|
||||
@@ -122,12 +123,7 @@ async fn unified_exec_reuses_session_via_stdin() -> Result<()> {
|
||||
})
|
||||
.await?;
|
||||
|
||||
loop {
|
||||
let event = codex.next_event().await.expect("event");
|
||||
if matches!(event.msg, EventMsg::TaskComplete(_)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
wait_for_event(&codex, |event| matches!(event, EventMsg::TaskComplete(_))).await;
|
||||
|
||||
let requests = server.received_requests().await.expect("recorded requests");
|
||||
assert!(!requests.is_empty(), "expected at least one POST request");
|
||||
|
||||
Reference in New Issue
Block a user