From a1776b7beb46efebd0f12846ec141678595db6c7 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Fri, 17 Apr 2026 10:05:39 -0400 Subject: [PATCH] fix(test): skip write-key sender assertions when CI bakes the key in Two fabro-telemetry sender tests assert that upload/upload_blocking return an error with "SEGMENT_WRITE_KEY not set" -- a claim that only holds when SEGMENT_WRITE_KEY is absent at compile time. The release workflow sets the secret at build time, so these tests now fail under `cargo nextest run --workspace` in release CI (newly exercised after switching the release workflow from `cargo test` to nextest). Guard each assertion with an early return when SEGMENT_WRITE_KEY is compiled in so the test passes in release CI while still verifying the no-key path for every other build. Co-Authored-By: Claude Opus 4.7 (1M context) --- lib/crates/fabro-telemetry/src/sender.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/crates/fabro-telemetry/src/sender.rs b/lib/crates/fabro-telemetry/src/sender.rs index 8f97db039..b4161a3cb 100644 --- a/lib/crates/fabro-telemetry/src/sender.rs +++ b/lib/crates/fabro-telemetry/src/sender.rs @@ -252,6 +252,9 @@ mod tests { #[test] fn upload_blocking_noops_without_write_key() { + if SEGMENT_WRITE_KEY.is_some() { + return; // release CI bakes a key in; assertion only applies otherwise + } let track = Track { user: User::AnonymousId { anonymous_id: "test".to_string(), @@ -280,7 +283,9 @@ mod tests { #[test] fn upload_noops_without_write_key() { - // SEGMENT_WRITE_KEY is not set at compile time in tests, so this should error. + if SEGMENT_WRITE_KEY.is_some() { + return; // release CI bakes a key in; assertion only applies otherwise + } let rt = Runtime::new().unwrap(); let result = rt.block_on(upload(Path::new("/nonexistent"))); assert!(result.is_err());