mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-18 23:02:18 +00:00
Stabilize Docker test PATH mounting in CI
This commit is contained in:
parent
f9b6ccc46f
commit
5e20011fd1
2 changed files with 19 additions and 2 deletions
|
|
@ -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());
|
env.insert("SANDBOX_AGENT_TEST_AUTH_TOKEN".to_string(), token.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
let custom_path_entries =
|
let mut custom_path_entries = custom_path_entries(layout.install_dir.parent().expect("install base"));
|
||||||
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() {
|
if custom_path_entries.is_empty() {
|
||||||
env.insert("PATH".to_string(), DEFAULT_PATH.to_string());
|
env.insert("PATH".to_string(), DEFAULT_PATH.to_string());
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -441,6 +444,18 @@ fn custom_path_entries(root: &Path) -> Vec<PathBuf> {
|
||||||
entries
|
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 {
|
fn rewrite_localhost_url(key: &str, value: &str) -> String {
|
||||||
if key.ends_with("_URL") || key.ends_with("_URI") {
|
if key.ends_with("_URL") || key.ends_with("_URI") {
|
||||||
return value
|
return value
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,8 @@ async fn lazy_install_runs_on_first_bootstrap() {
|
||||||
paths.extend(std::env::split_paths(&original_path));
|
paths.extend(std::env::split_paths(&original_path));
|
||||||
let merged_path = std::env::join_paths(paths).expect("join 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 _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| {
|
let test_app = TestApp::with_setup(AuthConfig::disabled(), |install_path| {
|
||||||
fs::create_dir_all(install_path.join("agent_processes"))
|
fs::create_dir_all(install_path.join("agent_processes"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue