Compat: the copy's pending tasks aren't this run's to wait for
The run against INBUXA's store hung printing "Waiting for pending task AcmeRenewal(...)": the copy carries that server's task queue, and a renewal due in 2026-11 will not come due while a test watches it. Under NO_INSERT the wait now skips tasks that aren't due and ones that have permanently failed, which leaves the tasks the test itself caused — a restore in undelete_compat comes due at once — and gives up after a minute with the offending task printed. A test that was really waiting on its own work now fails on its assertion, which says more than a spinner. Ordinary runs are untouched: system_tests, which waits on tasks throughout, still passes in 135s.
This commit is contained in:
@@ -109,6 +109,15 @@ fails on one of its own (`tests/src/utils/server.rs`). The copy is not
|
|||||||
edited to achieve this; its listeners are simply not what a compat run
|
edited to achieve this; its listeners are simply not what a compat run
|
||||||
needs.
|
needs.
|
||||||
|
|
||||||
|
**Why the copy's task queue is ignored.** A real server's pending tasks come
|
||||||
|
with its store: ACME renewals due months from now, work that can never run
|
||||||
|
on this machine. The harness waits for tasks to drain, so the first run
|
||||||
|
against INBUXA's copy sat printing `Waiting for pending task
|
||||||
|
AcmeRenewal(...)` until it was interrupted. Under `NO_INSERT` it now skips
|
||||||
|
tasks that aren't due and ones that have failed for good, and gives up
|
||||||
|
after a minute with the task printed, so the test fails on its own
|
||||||
|
assertion instead of spinning.
|
||||||
|
|
||||||
**Why `compat-` listeners appear in the copy.** The harness needs listeners
|
**Why `compat-` listeners appear in the copy.** The harness needs listeners
|
||||||
on its own ports, and the registry keys listeners by name. A real server
|
on its own ports, and the registry keys listeners by name. A real server
|
||||||
has its own, and a production listener called `jmap` or `imap` collided
|
has its own, and a production listener called `jmap` or `imap` collided
|
||||||
|
|||||||
@@ -281,6 +281,19 @@ async fn build_search_store(typ: SearchStoreType, _path: &str) -> SearchStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn wait_for_tasks(server: &Server, skip_not_due: bool, skip_permanent_failures: bool) {
|
pub async fn wait_for_tasks(server: &Server, skip_not_due: bool, skip_permanent_failures: bool) {
|
||||||
|
// inbuxa: a compat run opens a copy of a real server's store, and its
|
||||||
|
// task queue comes too: ACME renewals due months from now, work that
|
||||||
|
// can never run on this machine. Waiting for that to drain never ends,
|
||||||
|
// so skip what isn't due and what has already failed for good, and give
|
||||||
|
// up after a minute rather than hang. Whatever the test was waiting for
|
||||||
|
// then fails on its own assertion, which says more than a spinner.
|
||||||
|
let compat = std::env::var("NO_INSERT").is_ok();
|
||||||
|
let (skip_not_due, skip_permanent_failures) = if compat {
|
||||||
|
(true, true)
|
||||||
|
} else {
|
||||||
|
(skip_not_due, skip_permanent_failures)
|
||||||
|
};
|
||||||
|
let give_up_at = std::time::Instant::now() + std::time::Duration::from_secs(60);
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
loop {
|
loop {
|
||||||
let mut has_index_tasks = None;
|
let mut has_index_tasks = None;
|
||||||
@@ -315,6 +328,12 @@ pub async fn wait_for_tasks(server: &Server, skip_not_due: bool, skip_permanent_
|
|||||||
if count % 10 == 0 {
|
if count % 10 == 0 {
|
||||||
println!("Waiting for pending task {:?}...", task);
|
println!("Waiting for pending task {:?}...", task);
|
||||||
}
|
}
|
||||||
|
if compat && std::time::Instant::now() > give_up_at {
|
||||||
|
println!(
|
||||||
|
"Gave up waiting after 60s; this task is the copy's, not this run's: {task:?}"
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
tokio::time::sleep(std::time::Duration::from_millis(200)).await;
|
tokio::time::sleep(std::time::Duration::from_millis(200)).await;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user