v0.1.4-pre.015-fix.003

This commit is contained in:
2026-08-16 18:28:56 +02:00
parent 9ad61b40e1
commit d92eb01bc2
4 changed files with 74 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-config-desk/unit_tests/logging_editor.rs
// version: 3
// version: 4
#[test]
fn committed_logging_document_maps_complete_read_only_editor_contract() {
@@ -157,7 +157,8 @@ fn runtime_failure_rollback_restores_previous_logging_source() {
if let std::result::Result::Err(error) = rolled_back {
assert_eq!(error.code(), ksp_logging_lib::ERROR_CODE_RELOAD_FAILED);
}
assert_eq!(std::fs::read_to_string(root.join("config/std.logging.json")).ok(), std::option::Option::Some(previous));
let restored = std::fs::read_to_string(root.join("config").join(ksp_config_lib::DEFAULT_STD_LOGGING_FILENAME)).ok();
assert_eq!(restored, std::option::Option::Some(previous));
}
}
let cleanup = std::fs::remove_dir_all(root.as_path());
@@ -181,10 +182,10 @@ fn rollback_fixture() -> ksp_core_lib::Result<(std::path::PathBuf, ksp_config_li
return std::result::Result::Err(ksp_core_lib::Error::new(crate::ERROR_CODE_APP_STATE_INVALID, "cannot create rollback fixture").with_source(error));
}
let workspace = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../..");
let source_config = workspace.join("config/std.logging.json");
let source_schema = workspace.join("config/schemas/std.logging.schema.json");
let config_path = config_root.join("std.logging.json");
let schema_path = schema_root.join("std.logging.schema.json");
let source_config = workspace.join("config").join(ksp_config_lib::DEFAULT_STD_LOGGING_FILENAME);
let source_schema = workspace.join("config/schemas").join(ksp_config_lib::DEFAULT_STD_LOGGING_SCHEMA_FILENAME);
let config_path = config_root.join(ksp_config_lib::DEFAULT_STD_LOGGING_FILENAME);
let schema_path = schema_root.join(ksp_config_lib::DEFAULT_STD_LOGGING_SCHEMA_FILENAME);
let copied = std::fs::copy(source_config.as_path(), config_path.as_path());
if let std::result::Result::Err(error) = copied {
return std::result::Result::Err(

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-config-lib/unit_tests/logging.rs
// version: 3
// version: 4
#[test]
fn fixture_logging_profile_maps_complete_runtime_contract() {
@@ -316,29 +316,6 @@ fn resolved_logging_debug_uses_safe_effective_view() {
}
}
fn assert_file(
file: &ksp_logging_lib::FileSettings,
output_id: &str,
directory: &std::path::Path,
file_name: &str,
rotation: ksp_logging_lib::FileRotation,
format: ksp_logging_lib::LogFormat,
level: ksp_logging_lib::LogFilterLevel,
targets: &[&str],
domains: &[&str],
) {
assert_eq!(file.output_id(), output_id);
assert!(file.enabled());
assert_eq!(file.directory(), directory);
assert_eq!(file.file_name_prefix(), file_name);
assert_eq!(file.rotation(), rotation);
assert_eq!(file.format(), format);
assert!(!file.ansi());
assert_eq!(file.filter().level(), level);
assert_eq!(file.filter().targets().iter().map(String::as_str).collect::<std::vec::Vec<&str>>(), targets.to_vec());
assert_eq!(file.filter().domains().iter().map(String::as_str).collect::<std::vec::Vec<&str>>(), domains.to_vec());
}
fn fixture_engine() -> ksp_core_lib::Result<crate::ConfigDocumentEngine> {
let workspace = workspace_root();
let fixture_root = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("unit_tests/fixtures");