test(connect): use protected home for bootstrap fixtures (#6515)

This commit is contained in:
Zhengchao An
2026-08-24 18:21:53 +08:00
committed by GitHub
parent 762431c0c7
commit f6d69ce643
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -434,10 +434,11 @@ mod tests {
}; };
fn secure_tempdir() -> tempfile::TempDir { fn secure_tempdir() -> tempfile::TempDir {
let home = std::path::PathBuf::from(std::env::var_os("HOME").expect("test requires a protected home directory"));
tempfile::Builder::new() tempfile::Builder::new()
.prefix(".connect-registration-bootstrap-") .prefix(".connect-registration-bootstrap-")
.tempdir_in(env!("CARGO_MANIFEST_DIR")) .tempdir_in(home)
.expect("temporary directory inside the protected checkout") .expect("temporary directory inside the protected home directory")
} }
fn create_secure_state_tree(state: &Path) { fn create_secure_state_tree(state: &Path) {
@@ -278,10 +278,11 @@ fn prepare_inputs(temp: &tempfile::TempDir, root_pem: &str) -> (std::path::PathB
} }
fn secure_tempdir() -> tempfile::TempDir { fn secure_tempdir() -> tempfile::TempDir {
let home = std::path::PathBuf::from(std::env::var_os("HOME").expect("test requires a protected home directory"));
tempfile::Builder::new() tempfile::Builder::new()
.prefix(".connect-registration-") .prefix(".connect-registration-")
.tempdir_in(env!("CARGO_MANIFEST_DIR")) .tempdir_in(home)
.expect("temporary directory inside the protected checkout") .expect("temporary directory inside the protected home directory")
} }
fn run_binary(endpoint: String, root: std::path::PathBuf, state: std::path::PathBuf, token: Vec<u8>) -> std::process::Output { fn run_binary(endpoint: String, root: std::path::PathBuf, state: std::path::PathBuf, token: Vec<u8>) -> std::process::Output {