按评审意见强化回退模板读取通道回归测试
Project CI / Repository checks (pull_request) Successful in 2m47s
Project CI / Frontend tests (pull_request) Successful in 3m44s
Project CI / Backend tests (pull_request) Successful in 7m1s
Project CI / Native shell tests (pull_request) Successful in 18m11s
Project CI / Backend tests (push) Has been cancelled
Project CI / Native shell tests (push) Has been cancelled
Project CI / Frontend tests (push) Has been cancelled
Project CI / Repository checks (push) Has been cancelled
Project CI / Repository checks (pull_request) Successful in 2m47s
Project CI / Frontend tests (pull_request) Successful in 3m44s
Project CI / Backend tests (pull_request) Successful in 7m1s
Project CI / Native shell tests (pull_request) Successful in 18m11s
Project CI / Backend tests (push) Has been cancelled
Project CI / Native shell tests (push) Has been cancelled
Project CI / Frontend tests (push) Has been cancelled
Project CI / Repository checks (push) Has been cancelled
- tests/configuration.rs 回退模板测试改用与模板无关的 runtime dir,分类断言覆盖按路径归属而非 runtime dir 为 None 的恒真分支,并补充 runtime dir 内路径的 managed 正向断言 - tests/mod.rs 移除不再使用的 clear_test_runtime_config_dir 辅助
This commit was merged in pull request #321.
This commit is contained in:
@@ -1195,15 +1195,23 @@ fn fallback_template_read_stays_on_snapshot_channel_outside_runtime_dir() {
|
||||
"{\n \"llm\": { \"model\": \"fallback-template-model\" }\n}\n",
|
||||
)
|
||||
.expect("write fallback template");
|
||||
let _guard = clear_test_runtime_config_dir();
|
||||
// 设置一个与模板无关的 runtime dir,让分类断言真正覆盖"按路径归属"而非
|
||||
// "runtime dir 为 None 时恒 false"的全局开关。
|
||||
let runtime_root = unique_project_path();
|
||||
fs::create_dir_all(&runtime_root).expect("unrelated runtime config dir");
|
||||
let _guard = use_test_runtime_config_dir(runtime_root.clone());
|
||||
|
||||
// 仓库旁边的回退模板是共享输入,读取绝不能走会收紧 owner/DACL 的私有通道。
|
||||
assert!(!game_creator_config_path_is_runtime_managed(&template));
|
||||
assert!(game_creator_config_path_is_runtime_managed(
|
||||
&runtime_root.join(GAME_CREATOR_CONFIG_FILE_NAME)
|
||||
));
|
||||
let content = read_game_creator_config_file(&template).expect("read fallback template");
|
||||
assert!(content
|
||||
.expect("fallback template content")
|
||||
.contains("fallback-template-model"));
|
||||
fs::remove_dir_all(root).ok();
|
||||
fs::remove_dir_all(runtime_root).ok();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1327,20 +1327,6 @@ fn use_test_runtime_config_dir(path: PathBuf) -> TestRuntimeConfigDirGuard {
|
||||
}
|
||||
}
|
||||
|
||||
fn clear_test_runtime_config_dir() -> TestRuntimeConfigDirGuard {
|
||||
let lock = TEST_CONFIG_LOCK
|
||||
.lock()
|
||||
.unwrap_or_else(|poisoned| poisoned.into_inner());
|
||||
let previous = game_creator_runtime_config_dir();
|
||||
*game_creator_runtime_config_dir_lock()
|
||||
.lock()
|
||||
.expect("runtime config dir lock") = None;
|
||||
TestRuntimeConfigDirGuard {
|
||||
_lock: lock,
|
||||
previous,
|
||||
}
|
||||
}
|
||||
|
||||
fn assert_task_status(manifest: &Value, task_id: &str, status: &str) {
|
||||
let task = manifest["tasks"]
|
||||
.as_array()
|
||||
|
||||
Reference in New Issue
Block a user