summaryrefslogtreecommitdiff
path: root/src/integration/tests.rs
diff options
context:
space:
mode:
authorJJ Liebig <jonathan.liebig@gmail.com>2026-09-17 22:43:35 +0200
committerGitHub <noreply@github.com>2026-09-17 22:43:35 +0200
commit14351f121f6fc8c84b7c6c6eda78ad210e93cfcb (patch)
treeab2773993ac4f012e8dc52f757a7109b3af8b4d5 /src/integration/tests.rs
parent101ccc20d3c6483a38ed9e0a1239b2ab908b1704 (diff)
test: skip windows symlink tests without symlink privilege (#4311)
Windows refuses file symlinks with ERROR_PRIVILEGE_NOT_HELD (1314) unless the test process is elevated or Developer Mode is enabled, which broke non-admin local runs. Share a helper that reports the missing privilege so the two symlink tests skip only the symlink-dependent assertions.
Diffstat (limited to 'src/integration/tests.rs')
-rw-r--r--src/integration/tests.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/integration/tests.rs b/src/integration/tests.rs
index f7e2154e..bffe2f45 100644
--- a/src/integration/tests.rs
+++ b/src/integration/tests.rs
@@ -4,6 +4,8 @@ use super::env::*;
use super::file_ops::*;
use super::registry::*;
use super::targets::*;
+#[cfg(windows)]
+use super::test_support::symlink_file;
use super::types::*;
use super::version::*;
use super::*;
@@ -2565,11 +2567,12 @@ fn opencode_recovery_copy_blocks_retry_before_parsing_or_asset_changes() {
fs::write(&referent, "{").unwrap();
let linked_backup = base.join("preferences.json.herdr-backup");
fs::rename(&backup, &linked_backup).unwrap();
- std::os::windows::fs::symlink_file(&referent, &config).unwrap();
- let link_before = fs::read_link(&config).unwrap();
- let error = install_target(target).unwrap_err();
- assert!(error.to_string().contains("preferences.json.herdr-backup"));
- assert_eq!(fs::read_link(&config).unwrap(), link_before);
+ if symlink_file(&referent, &config) {
+ let link_before = fs::read_link(&config).unwrap();
+ let error = install_target(target).unwrap_err();
+ assert!(error.to_string().contains("preferences.json.herdr-backup"));
+ assert_eq!(fs::read_link(&config).unwrap(), link_before);
+ }
assert_eq!(fs::read_to_string(&plugin).unwrap(), "previous integration");
assert!(!dir.join("tui.jsonc").exists());
assert!(!dir.join(OPENCODE_V2_TUI_PLUGIN_DIR).exists());