aboutsummaryrefslogtreecommitdiff
path: root/src/integration/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/integration/tests.rs')
-rw-r--r--src/integration/tests.rs34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/integration/tests.rs b/src/integration/tests.rs
index fc332a84..78b728f9 100644
--- a/src/integration/tests.rs
+++ b/src/integration/tests.rs
@@ -94,6 +94,7 @@ fn enforce_agent_version_accepts_current_version() {
fn clear_integration_path_env() {
std::env::remove_var(PI_CODING_AGENT_DIR_ENV_VAR);
+ std::env::remove_var(OMP_CONFIG_DIR_ENV_VAR);
std::env::remove_var(CLAUDE_CONFIG_DIR_ENV_VAR);
std::env::remove_var(CODEX_HOME_ENV_VAR);
std::env::remove_var(COPILOT_HOME_ENV_VAR);
@@ -625,13 +626,14 @@ fn install_omp_preserves_non_herdr_file_with_pi_install_name() {
}
#[test]
-fn install_omp_uses_pi_coding_agent_dir_env() {
+fn install_omp_uses_pi_config_dir_env() {
let _lock = integration_env_lock();
let base = unique_base();
- let agent_dir = base.join("custom-omp-agent");
- let ext_dir = agent_dir.join("extensions");
+ let home = base.join("home");
+ let ext_dir = home.join("custom-omp/agent/extensions");
fs::create_dir_all(&ext_dir).unwrap();
- std::env::set_var(PI_CODING_AGENT_DIR_ENV_VAR, &agent_dir);
+ std::env::set_var("HOME", &home);
+ std::env::set_var(OMP_CONFIG_DIR_ENV_VAR, "custom-omp");
let installed = install_omp().unwrap();
@@ -641,6 +643,30 @@ fn install_omp_uses_pi_coding_agent_dir_env() {
);
assert!(!installed.removed_legacy_pi_extension);
+ std::env::remove_var("HOME");
+ clear_integration_path_env();
+ let _ = fs::remove_dir_all(base);
+}
+
+#[test]
+fn install_omp_refuses_shared_pi_extension_directory() {
+ let _lock = integration_env_lock();
+ let base = unique_base();
+ let agent_dir = base.join("shared-agent");
+ let ext_dir = agent_dir.join("extensions");
+ let pi_extension = ext_dir.join(PI_EXTENSION_INSTALL_NAME);
+ fs::create_dir_all(&ext_dir).unwrap();
+ fs::write(&pi_extension, PI_EXTENSION_ASSET).unwrap();
+ std::env::set_var(PI_CODING_AGENT_DIR_ENV_VAR, &agent_dir);
+ std::env::set_var(OMP_CONFIG_DIR_ENV_VAR, "ignored-omp-config");
+
+ let err = install_omp().unwrap_err().to_string();
+
+ assert!(err.contains("Pi and OMP resolve to the same extension directory"));
+ assert!(err.contains(&ext_dir.display().to_string()));
+ assert!(pi_extension.is_file());
+ assert!(!ext_dir.join(OMP_EXTENSION_INSTALL_NAME).exists());
+
clear_integration_path_env();
let _ = fs::remove_dir_all(base);
}