Add WebRTC support to realtime test server

Teach the shared test helper to accept realtime /calls POSTs, answer SDP offers, and relay scripted events over a data channel while logging incoming RTP audio packets as synthetic append requests. Update the one stale handshake-path assertion to the /realtime/calls URL.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Ahmed Ibrahim
2026-04-04 13:14:31 -07:00
parent 63c1223141
commit d6d8d6304d
5 changed files with 453 additions and 1 deletions

View File

@@ -37,6 +37,8 @@ use wiremock::matchers::path_regex;
use crate::test_codex::ApplyPatchModelOutput;
mod realtime_webrtc_server;
#[derive(Debug, Clone)]
pub struct ResponseMock {
requests: Arc<Mutex<Vec<ResponsesRequest>>>,
@@ -1238,6 +1240,29 @@ pub async fn start_websocket_server_with_headers(
tokio::time::sleep(delay).await;
}
if realtime_webrtc_server::accept_is_http_post(&stream).await {
let connection_index = {
let mut log = requests.lock().unwrap();
log.push(Vec::new());
log.len() - 1
};
realtime_webrtc_server::serve_connection(
stream,
connection,
connection_index,
Arc::clone(&requests),
Arc::clone(&handshakes),
Arc::clone(&request_log),
start,
)
.await;
if connections.lock().unwrap().is_empty() {
return;
}
continue;
}
let response_headers = connection.response_headers.clone();
let handshake_log = Arc::clone(&handshakes);
let callback = move |req: &Request, mut response: Response| {