[edge] Resolver and control start, tests first (QC nits): a lookup thread that panics must not leave its name stuck, and a kept tree that breaks a changed [ui] config is not written to the engines at start (red)

This commit is contained in:
2026-11-22 19:04:35 +01:00
parent af36e083ee
commit 6f259e410a
2 changed files with 81 additions and 0 deletions
+27
View File
@@ -258,6 +258,33 @@ mod tests {
assert_eq!(started.load(Ordering::SeqCst), 1);
}
/// QC phase 4 (nit): a lookup thread that panics must not leave its name stuck on a dead
/// lookup; the next request for it starts a new one.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn a_panicking_lookup_does_not_poison_its_name() {
let calls = Arc::new(AtomicUsize::new(0));
let c = calls.clone();
let r = Resolver::new(1, move |_, port| {
if c.fetch_add(1, Ordering::SeqCst) == 0 {
panic!("resolver library bug");
}
Ok(vec![SocketAddr::from(([127, 0, 0, 1], port))])
});
assert!(r.resolve("flaky.test", 80, SHORT).await.is_err());
let mut got = None;
for _ in 0..50 {
match r.resolve("flaky.test", 80, SHORT).await {
Ok(a) => {
got = Some(a);
break;
}
Err(_) => tokio::time::sleep(Duration::from_millis(20)).await,
}
}
assert_eq!(got.unwrap(), vec![SocketAddr::from(([127, 0, 0, 1], 80))]);
assert_eq!(calls.load(Ordering::SeqCst), 2);
}
#[tokio::test]
async fn literals_empty_answers_and_errors() {
let r = Resolver::new(1, |host, _| match host {