CI: isolate Windows agent-link startup tests

This commit is contained in:
FredApps authored and GitHub committed 2026-11-29 19:35:28 +01:00
1 parent cf0753ad7b
commit 70e5849baa
2 files changed
+25 -3

No files matched your search

+7
View File
@@ -65,6 +65,13 @@ archive.include = [
filter = 'binary(panic_hunt)'
slow-timeout = { period = "15s", terminate-after = 12 }
# Agent Link startup checks real Windows file ownership using timed system helpers.
# Run these three cases without other tests in the shard competing for the runner.
[[profile.ci.overrides]]
platform = 'cfg(target_os = "windows")'
filter = 'package(photocraft-ui-egui) & (test(=prefs::prefs_ui::agents_tests::preferences_start_and_stop_the_agent_link_and_the_policy_follows) | test(=prefs::prefs_ui::agents_tests::with_the_flag_the_launcher_switch_alone_turns_the_agent_link_on_and_off) | test(=prefs::prefs_ui::agents_tests::without_the_flag_the_launcher_switch_means_nothing))'
threads-required = "num-test-threads"
# Content-Aware Move solves on rayon across every core. On the Windows runner the GPU tests draw
# on the CPU-backed adapter, so two of these beside a GPU test starve it until its device poll
# times out. Each runs alone there.
@@ -36,6 +36,21 @@ fn port(app: &PhotocraftApp) -> Option<u16> {
app.services.agent_link.as_ref().and_then(|link| link.status().port)
}
/// Report the failing startup stage without dumping connection or token details.
fn startup_problem(app: &PhotocraftApp) -> &'static str {
match app.services.agent_link.as_ref().and_then(|link| link.status().problem.as_ref()) {
Some(LinkProblem::NotAllowed) => "agent control disabled",
Some(LinkProblem::NoSettingsFolder) => "settings folder missing",
Some(LinkProblem::TokenFile(_)) => "token file preparation or validation failed",
Some(LinkProblem::Listen { .. }) => "local listener failed",
Some(LinkProblem::PortOutOfRange(_)) => "control port out of range",
Some(LinkProblem::Publish(_)) => "connection file publication failed",
Some(LinkProblem::App(_)) => "app policy problem",
Some(_) => "other link problem",
None => "no link problem reported",
}
}
#[test]
fn preferences_start_and_stop_the_agent_link_and_the_policy_follows() {
let (mut app, _dir, asked) = linked_app(AgentSwitch::fixed(false, false));
@@ -48,7 +63,7 @@ fn preferences_start_and_stop_the_agent_link_and_the_policy_follows() {
// On: the control channel and the policy over the chosen folder, without a restart.
app.run("prefs.set", json!({"values": {"integrations.connectAgents": true, "integrations.readRoot": "/work"}})).unwrap();
tick(&mut app, &ctx);
assert!(port(&app).is_some() && app.control.is_some());
assert!(port(&app).is_some() && app.control.is_some(), "agent link did not start: {}", startup_problem(&app));
assert!(app.services.automation_command.is_some());
assert!(app.session.automation_gate.is_some(), "actions agents record keep the policy");
assert_eq!(asked.lock().unwrap().last().map(|s| s.read_root.clone()).as_deref(), Some("/work"));
@@ -85,7 +100,7 @@ fn with_the_flag_the_launcher_switch_alone_turns_the_agent_link_on_and_off() {
app.services.agent_switch = Some(AgentSwitch::fixed(true, true));
tick(&mut app, &ctx);
let on = port(&app);
assert!(on.is_some() && app.control.is_some(), "the launcher's switch alone starts it");
assert!(on.is_some() && app.control.is_some(), "the launcher's switch alone starts it: {}", startup_problem(&app));
tick(&mut app, &ctx);
assert_eq!((port(&app), asked.lock().unwrap().len()), (on, 1), "no change, no restart");
app.services.agent_switch = Some(AgentSwitch::fixed(true, false));
@@ -103,7 +118,7 @@ fn without_the_flag_the_launcher_switch_means_nothing() {
assert!(port(&app).is_none(), "the launcher's switch needs the flag");
app.run("prefs.set", json!({"values": {"integrations.connectAgents": true}})).unwrap();
tick(&mut app, &ctx);
assert!(port(&app).is_some(), "a saved Control Port still counts");
assert!(port(&app).is_some(), "a saved Control Port still counts: {}", startup_problem(&app));
}
#[test]