Skip polling delays in the external queue lifecycle test (#46714)

## Why

The external queue lifecycle test waits through watcher and retry intervals,
including explicit 11-second sleeps.

## What changed

Run the test on Tokio's current-thread runtime and use `advance_queue_poll()`
to pause time, advance it by 11 seconds, and resume it at polling boundaries.
This skips interval waits while keeping the clock advancing during real I/O.

GitOrigin-RevId: 0d1c3f53cc8b79559d6a20b5c9e70b58216e4b4d
This commit is contained in:
Charlie Marsh
2026-09-19 20:41:08 +00:00
committed by copyberry
parent ed0ee704b4
commit 50a90f3408
+13 -3
View File
@@ -569,7 +569,14 @@ async fn registered_queue_lifecycle_starts_messages_in_fifo_order() -> anyhow::R
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
/// Skip a watcher/retry interval while keeping real I/O on an advancing clock.
async fn advance_queue_poll() {
tokio::time::pause();
tokio::time::advance(Duration::from_secs(/*secs*/ 11)).await;
tokio::time::resume();
}
#[tokio::test]
async fn externally_changed_queues_dispatch_independently_and_retry_failed_wakes()
-> anyhow::Result<()> {
let server = start_mock_server().await;
@@ -638,6 +645,7 @@ async fn externally_changed_queues_dispatch_independently_and_retry_failed_wakes
)
.await?;
advance_queue_poll().await;
wait_for_event_with_timeout(
independent_thread.thread.as_ref(),
|event| matches!(event, EventMsg::TurnComplete(_)),
@@ -647,13 +655,14 @@ async fn externally_changed_queues_dispatch_independently_and_retry_failed_wakes
assert_eq!(1, model_responses.requests().len());
assert_eq!(vec![updated], queue.list(thread_id).await?);
advance_queue_poll().await;
wait_for_event_with_timeout(
test.codex.as_ref(),
|event| matches!(event, EventMsg::TurnComplete(_)),
Duration::from_secs(/*secs*/ 25),
)
.await;
tokio::time::sleep(Duration::from_secs(/*secs*/ 11)).await;
advance_queue_poll().await;
assert!(queue.list(thread_id).await?.is_empty());
assert!(queue.list(independent_thread.thread_id).await?.is_empty());
@@ -664,7 +673,7 @@ async fn externally_changed_queues_dispatch_independently_and_retry_failed_wakes
external_queue
.enqueue(thread_id, user_input("queued before ordinary resume"))
.await?;
tokio::time::sleep(Duration::from_secs(/*secs*/ 11)).await;
advance_queue_poll().await;
let resumed = test
.thread_manager
.resume_thread_from_rollout(
@@ -675,6 +684,7 @@ async fn externally_changed_queues_dispatch_independently_and_retry_failed_wakes
Default::default(),
)
.await?;
advance_queue_poll().await;
wait_for_event_with_timeout(
resumed.thread.as_ref(),
|event| matches!(event, EventMsg::TurnComplete(_)),