v0.1.3-pre.010-fix.001

This commit is contained in:
2026-08-15 22:02:29 +02:00
parent 1fc002c978
commit 695068acea
3 changed files with 78 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-config-lib/unit_tests/environment.rs
// version: 1
// version: 2
#[test]
fn process_environment_wins_over_dotenv_and_fallback_even_when_empty() {
@@ -175,7 +175,8 @@ fn fake_process_collection_filters_unrelated_names_without_mutating_real_environ
#[test]
fn committed_logging_profile_resolves_environment_fallback_without_changing_source_profile() {
let bootstrap = crate::ConfigBootstrapOptions::from_paths(std::path::PathBuf::from("config"), std::path::PathBuf::from("config/schemas"));
let workspace = workspace_root();
let bootstrap = crate::ConfigBootstrapOptions::from_paths(workspace.join("config"), workspace.join("config/schemas"));
assert!(bootstrap.is_ok(), "bootstrap should resolve committed roots");
let bootstrap = match bootstrap {
std::result::Result::Ok(value) => value,
@@ -212,7 +213,7 @@ fn committed_logging_profile_resolves_environment_fallback_without_changing_sour
#[test]
fn env_example_inventory_contains_current_runtime_variable_with_preceding_comment() {
let content = std::fs::read_to_string(".env.example");
let content = std::fs::read_to_string(workspace_root().join(crate::DEFAULT_DOTENV_EXAMPLE_PATH));
assert!(content.is_ok(), ".env.example must be committed at workspace root");
let content = match content {
std::result::Result::Ok(value) => value,
@@ -229,3 +230,7 @@ fn env_example_inventory_contains_current_runtime_variable_with_preceding_commen
}
assert!(found, "current Config environment variable must appear in .env.example");
}
fn workspace_root() -> std::path::PathBuf {
return std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../..");
}