test: stabilize gateway nextest timing

This commit is contained in:
elky
2026-06-30 18:42:57 +08:00
parent f179ee72f9
commit 778b106023
3 changed files with 24 additions and 9 deletions
@@ -2373,12 +2373,27 @@ async fn gateway_retries_next_local_openai_chat_stream_candidate_after_retryable
assert_eq!(stored_candidates.len(), 2);
let failed_candidate = stored_candidates
.iter()
.find(|candidate| candidate.candidate_index == 0)
.expect("primary failed candidate should be stored");
.find(|candidate| {
candidate.status == RequestCandidateStatus::Failed && candidate.status_code == Some(429)
})
.expect("retryable 429 failed candidate should be stored");
let success_candidate = stored_candidates
.iter()
.find(|candidate| candidate.candidate_index == 1)
.find(|candidate| {
candidate.status == RequestCandidateStatus::Success
&& candidate.status_code == Some(200)
})
.expect("backup success candidate should be stored");
assert_ne!(
(
failed_candidate.candidate_index,
failed_candidate.retry_index
),
(
success_candidate.candidate_index,
success_candidate.retry_index
)
);
assert_eq!(failed_candidate.status, RequestCandidateStatus::Failed);
assert_eq!(failed_candidate.status_code, Some(429));
assert_eq!(
@@ -1257,11 +1257,11 @@ async fn gateway_executes_openai_responses_sync_after_api_key_concurrency_wait_b
.await
.expect("inflight request should complete")
});
wait_until(1_000, || {
wait_until(5_000, || {
*execution_runtime_hits.lock().expect("mutex should lock") >= 1
})
.await;
let pending_deadline = tokio::time::Instant::now() + std::time::Duration::from_millis(1_000);
let pending_deadline = tokio::time::Instant::now() + std::time::Duration::from_millis(5_000);
loop {
let inflight_candidates = request_candidate_repository
.list_by_request_id("trace-openai-cli-local-timeout-inflight-123")