fix: add env_lock guard to git discovery tests

This commit is contained in:
YeonGyu-Kim
2026-04-01 19:00:28 +09:00
parent 8ca53dec0d
commit 331c9dbb9d
3 changed files with 8 additions and 6 deletions

View File

@@ -118,7 +118,7 @@ where
tool_executor,
permission_policy,
system_prompt,
&RuntimeFeatureConfig::default(),
RuntimeFeatureConfig::default(),
)
}
@@ -129,7 +129,7 @@ where
tool_executor: T,
permission_policy: PermissionPolicy,
system_prompt: Vec<String>,
feature_config: &RuntimeFeatureConfig,
feature_config: RuntimeFeatureConfig,
) -> Self {
let usage_tracker = UsageTracker::from_session(&session);
Self {
@@ -140,7 +140,7 @@ where
system_prompt,
max_iterations: usize::MAX,
usage_tracker,
hook_runner: HookRunner::from_feature_config(feature_config),
hook_runner: HookRunner::from_feature_config(&feature_config),
}
}
@@ -609,7 +609,7 @@ mod tests {
}),
PermissionPolicy::new(PermissionMode::DangerFullAccess),
vec!["system".to_string()],
&RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
vec![shell_snippet("printf 'blocked by hook'; exit 2")],
Vec::new(),
)),
@@ -675,7 +675,7 @@ mod tests {
StaticToolExecutor::new().register("add", |_input| Ok("4".to_string())),
PermissionPolicy::new(PermissionMode::DangerFullAccess),
vec!["system".to_string()],
&RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
vec![shell_snippet("printf 'pre hook ran'")],
vec![shell_snippet("printf 'post hook ran'")],
)),

View File

@@ -600,6 +600,7 @@ mod tests {
#[test]
fn discover_with_git_includes_status_snapshot() {
let _guard = env_lock();
let root = temp_dir();
fs::create_dir_all(&root).expect("root dir");
std::process::Command::new("git")
@@ -624,6 +625,7 @@ mod tests {
#[test]
fn discover_with_git_includes_diff_snapshot_for_tracked_changes() {
let _guard = env_lock();
let root = temp_dir();
fs::create_dir_all(&root).expect("root dir");
std::process::Command::new("git")

View File

@@ -1933,7 +1933,7 @@ fn build_runtime(
CliToolExecutor::new(allowed_tools, emit_output),
permission_policy(permission_mode),
system_prompt,
&feature_config,
feature_config,
))
}