From 49d8e1bc71cf52da9808e31e47e136750b7cc6eb Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 19 Nov 2026 13:36:34 +0800 Subject: [PATCH] test: fix main CI failures on Windows and slow runners (#4437) Windows: compare the java-analyzer jdkHome with dunce::canonicalize (std adds the \\?\ prefix). macOS: wait for the hard-deadline interruption instead of a fixed sleep. Ubuntu: give a reclaimed plugin instance room to restart within the run-target validation timeout. --- crates/ide-host/tests/plugin_workbench.rs | 3 ++- crates/ide-host/tests/plugins.rs | 6 +++++- crates/ide-sdk/src/tests.rs | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/ide-host/tests/plugin_workbench.rs b/crates/ide-host/tests/plugin_workbench.rs index bf05992b6..2e01ecd05 100644 --- a/crates/ide-host/tests/plugin_workbench.rs +++ b/crates/ide-host/tests/plugin_workbench.rs @@ -471,7 +471,8 @@ async fn run_target_validation_gates_launches_and_preserves_selection() { f._tmp.path().join("plugins"), Arc::new(|_: Option<&str>, _| {}), Limits { - timeout: Duration::from_millis(200), + // Room for a reclaimed instance to start again on a slow runner. + timeout: Duration::from_millis(750), idle_timeout: Some(Duration::from_millis(20)), restart_backoff: Duration::ZERO, ..Default::default() diff --git a/crates/ide-host/tests/plugins.rs b/crates/ide-host/tests/plugins.rs index e0da1b105..e6592fa47 100644 --- a/crates/ide-host/tests/plugins.rs +++ b/crates/ide-host/tests/plugins.rs @@ -1560,7 +1560,11 @@ fn edit_path_calls_have_soft_and_hard_deadlines() { // Past the hard deadline: interrupted; the next call gets a new instance. assert!(provider.highlights(&mis, "spin").is_none()); std::thread::sleep(Duration::from_millis(450)); - host.tick(); + // A slow runner may interrupt the spinning call a little after its deadline. + assert!(eventually(|| { + host.tick(); + host.info_of("misbehave").unwrap().stats.crashes > 0 + })); let info = host.info_of("misbehave").unwrap(); assert_eq!(info.stats.crashes, 1, "{:?}", info.error); assert!(info.error.as_deref().is_some_and(|e| e.contains("timed out after 400ms")), "{:?}", info.error); diff --git a/crates/ide-sdk/src/tests.rs b/crates/ide-sdk/src/tests.rs index 0dc07c66a..92226cb17 100644 --- a/crates/ide-sdk/src/tests.rs +++ b/crates/ide-sdk/src/tests.rs @@ -359,7 +359,7 @@ fn java_analyzer_gets_the_project_jdk_and_maven_local_repository() { s.languages.java.jdk = jdk.to_string_lossy().into_owned(); s.languages.java.maven.local_repository = repo.to_string_lossy().into_owned(); let options = configured(&s).unwrap(); - assert_eq!(options["jdkHome"], jdk.canonicalize().unwrap().to_string_lossy().as_ref()); + assert_eq!(options["jdkHome"], dunce::canonicalize(&jdk).unwrap().to_string_lossy().as_ref()); assert_eq!(options["maven"]["localRepository"], repo.to_string_lossy().as_ref()); // A `jdkHome` in the server's own settings wins. s.language_servers.insert(