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) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-04-17 10:05:39 -04:00
parent 8ce451869f
commit a1776b7beb
No known key found for this signature in database

View file

@ -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());