Skip to content

Commit 6e9d68b

Browse files
runningcodeclaude
andcommitted
fix(build): Check version override env var at runtime for integration tests
Previously, the version override only worked when cfg(test) was enabled, which didn't include integration tests that spawn the CLI as a subprocess. This caused CI test failures because the env var was never checked in the actual binary. This change removes the cfg(test) conditional and renames the env var to SENTRY_CLI_INTEGRATION_TEST_VERSION_OVERRIDE to clarify it's for testing purposes only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent eb56253 commit 6e9d68b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/utils/build/normalize.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ use zip::{DateTime, ZipWriter};
2020
fn get_version() -> Cow<'static, str> {
2121
let version = Cow::Borrowed(VERSION);
2222

23-
#[cfg(test)]
24-
let version = std::env::var("SENTRY_CLI_VERSION_OVERRIDE")
23+
// Integration tests can override the version for consistent test results.
24+
// This ensures deterministic checksums in test fixtures by using a fixed version.
25+
let version = std::env::var("SENTRY_CLI_INTEGRATION_TEST_VERSION_OVERRIDE")
2526
.map(Cow::Owned)
2627
.unwrap_or(version);
2728

tests/integration/build/upload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fn command_build_upload_apk_chunked() {
176176
.expect(2),
177177
)
178178
.register_trycmd_test("build/build-upload-apk.trycmd")
179-
.env("SENTRY_CLI_VERSION_OVERRIDE", "0.0.0-test")
179+
.env("SENTRY_CLI_INTEGRATION_TEST_VERSION_OVERRIDE", "0.0.0-test")
180180
.with_default_token();
181181
}
182182

0 commit comments

Comments
 (0)