Stabilize Docker test PATH mounting in CI

This commit is contained in:
Nathan Flurry 2026-03-08 12:59:43 -07:00
parent 315fd2c3a4
commit 9bbe88f176
2 changed files with 19 additions and 2 deletions

View file

@ -240,8 +240,11 @@ fn build_env(layout: &TestLayout, auth: &AuthConfig) -> BTreeMap<String, String>
env.insert("SANDBOX_AGENT_TEST_AUTH_TOKEN".to_string(), token.clone());
}
let custom_path_entries =
custom_path_entries(layout.install_dir.parent().expect("install base"));
let mut custom_path_entries = custom_path_entries(layout.install_dir.parent().expect("install base"));
custom_path_entries.extend(explicit_path_entries());
custom_path_entries.sort();
custom_path_entries.dedup();
if custom_path_entries.is_empty() {
env.insert("PATH".to_string(), DEFAULT_PATH.to_string());
} else {
@ -441,6 +444,18 @@ fn custom_path_entries(root: &Path) -> Vec<PathBuf> {
entries
}
fn explicit_path_entries() -> Vec<PathBuf> {
let mut entries = Vec::new();
if let Some(value) = std::env::var_os("SANDBOX_AGENT_TEST_EXTRA_PATHS") {
for entry in std::env::split_paths(&value) {
if entry.is_absolute() && entry.exists() {
entries.push(entry);
}
}
}
entries
}
fn rewrite_localhost_url(key: &str, value: &str) -> String {
if key.ends_with("_URL") || key.ends_with("_URI") {
return value

View file

@ -187,6 +187,8 @@ async fn lazy_install_runs_on_first_bootstrap() {
paths.extend(std::env::split_paths(&original_path));
let merged_path = std::env::join_paths(paths).expect("join PATH");
let _path_guard = EnvVarGuard::set_os("PATH", merged_path.as_os_str());
let _extra_paths_guard =
EnvVarGuard::set_os("SANDBOX_AGENT_TEST_EXTRA_PATHS", helper_bin.as_os_str());
let test_app = TestApp::with_setup(AuthConfig::disabled(), |install_path| {
fs::create_dir_all(install_path.join("agent_processes"))