[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
+54
View File
@@ -385,6 +385,60 @@ url = \"{}\"
assert!(r.text().contains("\"hosts\""), "{}", r.text());
}
/// QC phase 4 (nit): a tree kept under one `[ui] socket` and read at start under another
/// is not written to the engines; the reason is logged.
#[tokio::test(flavor = "multi_thread")]
async fn a_kept_socket_upstream_that_breaks_a_changed_config_is_not_written_at_start() {
let auth = MockAuthelia::start().await;
let site = format!(
"secrets = [\"ui-proof\"]
[forward_auth]
url = \"{}\"
",
auth.url()
);
let (mut env, sock) = socket_env(site, "a.test").await;
let host = json!({"host": {
"hostname": "a.test", "upstreams": [format!("unix:{}", sock.display())],
"tls": "domi", "auth": "forward-auth",
"request_headers": [{"action": "set", "name": "X-Ianitor-Proof", "secret": "ui-proof"}]
}});
let rec = env.apply("POST", "/api/v1/hosts", Some(host)).await;
assert_eq!(
rec["state"],
"kept",
"{rec}
{}",
env.control_log()
);
env.kill_control();
// A marker in place of edge.json: a start that writes the tree to the engines replaces it.
let before = b"{\"marker\": \"left by the test\"}\n".to_vec();
std::fs::write(env.dir.join("edge/edge.json"), &before).unwrap();
let moved = env.dir.join("ui-moved.sock");
let text = std::fs::read_to_string(env.config_path())
.unwrap()
.replace(&sock.display().to_string(), &moved.display().to_string());
std::fs::write(env.config_path(), text).unwrap();
env.start_control(None);
for _ in 0..100 {
if env.control_log().contains("breaks control's rules") {
break;
}
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
}
assert!(
env.control_log().contains("breaks control's rules"),
"{}",
env.control_log()
);
assert_eq!(
std::fs::read(env.dir.join("edge/edge.json")).unwrap(),
before,
"the tree was not written to the engines"
);
}
/// QC: signed in at Authelia (alice) but the client also sends a proof guess: edge must
/// replace, not append, the proof; and Remote-User must be Authelia's.
#[tokio::test(flavor = "multi_thread")]