test: remove duplicated resource content assertions

This commit is contained in:
2026-08-18 02:20:32 +09:00
parent 99170d47ab
commit 46767daf49
11 changed files with 101 additions and 683 deletions
+6 -79
View File
@@ -4217,13 +4217,12 @@ mod tests {
}
#[test]
fn embedded_orchestrator_profile_enables_workdir_and_worker_authority() {
fn embedded_builtin_decodal_profiles_resolve_through_archive() {
let root = tempfile::tempdir().unwrap();
let broker = BackendResourceBroker::default();
let runtime_id = "runtime-test";
let selector = ProfileSelector::Builtin("builtin:orchestrator".to_string());
let bundle = builtin_profile_config_bundle(
&selector,
&ProfileSelector::Builtin("builtin:companion".to_string()),
"workspace-test",
Some(runtime_id),
&broker,
@@ -4231,6 +4230,7 @@ mod tests {
)
.unwrap();
let handle = bundle.profile_source_archive_handle.as_ref().unwrap();
assert!(bundle.profile_source_archive.is_none());
let response = broker
.fetch_profile_source_archive(worker_runtime::resource::BackendResourceFetchRequest {
handle: handle.clone(),
@@ -4244,85 +4244,12 @@ mod tests {
.unwrap()
.verify()
.unwrap();
let manifest = archive
.resolve_profile("builtin:orchestrator", root.path(), "embedded-orchestrator")
.unwrap();
assert!(manifest.feature.manage_workdir.enabled);
assert!(!manifest.feature.sub_worker.enabled);
assert!(manifest.feature.worker.enabled);
}
#[test]
fn embedded_companion_profile_enables_worker_management() {
let root = tempfile::tempdir().unwrap();
let selector = ProfileSelector::Builtin("builtin:companion".to_string());
let archive = builtin_profile_source_archive(&selector)
.unwrap()
.verify()
.unwrap();
let manifest = archive
.resolve_profile("builtin:companion", root.path(), "companion-test-worker")
.unwrap();
assert!(manifest.feature.worker.enabled);
assert!(manifest.feature.sub_worker.enabled);
assert!(!manifest.feature.manage_workdir.enabled);
}
#[test]
fn embedded_builtin_decodal_profiles_resolve_through_archive() {
let root = tempfile::tempdir().unwrap();
let broker = BackendResourceBroker::default();
let runtime_id = "runtime-test";
for selector in [
ProfileSelector::Builtin("builtin:companion".to_string()),
ProfileSelector::Builtin("builtin:intake".to_string()),
ProfileSelector::Builtin("builtin:orchestrator".to_string()),
ProfileSelector::Builtin("builtin:coder".to_string()),
ProfileSelector::Builtin("builtin:reviewer".to_string()),
ProfileSelector::Builtin("builtin:memory-consolidation".to_string()),
] {
let bundle = builtin_profile_config_bundle(
&selector,
"workspace-test",
Some(runtime_id),
&broker,
ProfileSourceArchiveTransport::BackendResourceHandle,
)
.unwrap();
let handle = bundle.profile_source_archive_handle.as_ref().unwrap();
assert!(bundle.profile_source_archive.is_none());
let response = broker
.fetch_profile_source_archive(
worker_runtime::resource::BackendResourceFetchRequest {
handle: handle.clone(),
runtime_id: runtime_id.to_string(),
worker_id: None,
audit_correlation_id: handle.audit_correlation_id.clone(),
},
)
.unwrap();
let archive =
worker_runtime::resource::profile_source_archive_from_response(handle, response)
.unwrap()
.verify()
.unwrap();
let selector_key = match &selector {
ProfileSelector::Builtin(name) | ProfileSelector::Named(name) => name.clone(),
};
assert!(!archive.reference().source_graph.entrypoints.is_empty());
for selector_key in archive.reference().source_graph.entrypoints.keys() {
let manifest = archive
.resolve_profile(&selector_key, root.path(), "embedded-test-worker")
.resolve_profile(selector_key, root.path(), "embedded-test-worker")
.unwrap();
assert_eq!(manifest.worker.name, "embedded-test-worker");
assert_eq!(
manifest.model.ref_.as_deref(),
Some("codex-oauth/gpt-5.6-sol")
);
if selector_key == "builtin:memory-consolidation" {
assert!(manifest.feature.memory.enabled);
assert!(manifest.feature.memory.staging);
}
}
}
@@ -740,32 +740,6 @@ mod tests {
}
}
#[test]
fn virtual_config_projection_is_builtin_only_by_default() {
let state = virtual_state(vec![
config_source::ConfigEntry::new(
VirtualPath::parse("main.dcdl").unwrap(),
ConfigContentType::Decodal,
"{}",
)
.unwrap(),
]);
let projection = project_profiles_from_workspace_config("workspace-test", &state).unwrap();
assert_eq!(
projection.settings.default_profile.as_deref(),
Some("builtin:companion")
);
assert_eq!(projection.settings.config_revision, Some(7));
assert!(projection.settings.projection_digest.is_some());
assert!(
projection
.settings
.profiles
.iter()
.all(|item| !item.editable)
);
}
#[test]
fn virtual_config_projection_builds_archive_from_active_revision() {
let state = virtual_state(vec![
@@ -795,8 +769,7 @@ mod tests {
assert_eq!(projection.settings.config_revision, Some(7));
let prompt_catalog = bundle.prompt_catalog.as_ref().unwrap();
assert_eq!(prompt_catalog.config_revision, 7);
assert!(prompt_catalog.templates.contains_key("default"));
assert!(prompt_catalog.templates.contains_key("common.workspace"));
assert!(!prompt_catalog.templates.is_empty());
assert!(
bundle
.metadata
@@ -115,12 +115,16 @@ mod tests {
#[test]
fn workspace_override_deep_patches_builtin_and_preserves_other_leaves() {
let baseline = project_prompts_from_workspace_config(&state("{}")).unwrap();
let state = state(r#"{ prompts = { common = { language = "OVERRIDE"; }; }; }"#);
let catalog = project_prompts_from_workspace_config(&state).unwrap();
assert_eq!(catalog.config_revision, 7);
assert_eq!(catalog.templates["common.language"], "OVERRIDE");
assert!(!catalog.templates["common.workspace"].is_empty());
assert!(catalog.templates["default"].contains("common.workspace"));
for (key, value) in baseline.templates {
if key != "common.language" {
assert_eq!(catalog.templates.get(&key), Some(&value));
}
}
}
#[test]