Skip to content

Commit a4eab3e

Browse files
committed
fix: use CARGO env var in template_env_expansion test (cross-platform)
HOME is not set on Windows GHA runners. CARGO is always set by cargo/cargo-test on every platform, making the test reliable on both Linux and Windows.
1 parent e1b5a29 commit a4eab3e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

crates/mycelium-graph/src/application/pipeline_parser.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -854,17 +854,19 @@ depends_on = ["a"]
854854

855855
#[test]
856856
fn template_env_expansion() {
857-
// Use HOME which is always set on Unix — avoids unsafe set_var
858-
let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".to_string());
859-
let toml = r#"
857+
// Use CARGO which is always set by cargo on every platform (Unix + Windows).
858+
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_string());
859+
let toml = format!(
860+
r#"
860861
[[nodes]]
861862
name = "n"
862863
service = "http"
863-
url = "${env:HOME}"
864-
"#;
865-
let mut def = PipelineParser::from_str(toml).unwrap();
864+
url = "${{env:CARGO}}"
865+
"#
866+
);
867+
let mut def = PipelineParser::from_str(&toml).unwrap();
866868
def.expand_templates();
867-
assert_eq!(def.nodes[0].url.as_deref(), Some(home.as_str()));
869+
assert_eq!(def.nodes[0].url.as_deref(), Some(cargo.as_str()));
868870
}
869871

870872
#[test]

0 commit comments

Comments
 (0)