Fix secrets fallback test isolation

This commit is contained in:
Adam Perry
2026-06-09 17:42:54 +00:00
parent 1384a101b5
commit 551cd310a3
+8 -2
View File
@@ -140,7 +140,12 @@ impl SecretsManager {
}
pub fn environment_id_from_cwd(cwd: &Path) -> String {
if let Some(repo_root) = get_git_repo_root(cwd)
let repo_root = get_git_repo_root(cwd);
environment_id_from_cwd_with_repo_root(cwd, repo_root.as_deref())
}
fn environment_id_from_cwd_with_repo_root(cwd: &Path, repo_root: Option<&Path>) -> String {
if let Some(repo_root) = repo_root
&& let Some(name) = repo_root.file_name()
{
let name = name.to_string_lossy().trim().to_string();
@@ -189,7 +194,8 @@ mod tests {
#[test]
fn environment_id_fallback_has_cwd_prefix() {
let dir = tempfile::tempdir().expect("tempdir");
let env_id = environment_id_from_cwd(dir.path());
// The system temp directory may itself be nested under a Git marker.
let env_id = environment_id_from_cwd_with_repo_root(dir.path(), /*repo_root*/ None);
let canonical = dir
.path()
.canonicalize()