diff --git a/src/commands/update.rs b/src/commands/update.rs index 3f5138b7cd..b7ce087fb5 100644 --- a/src/commands/update.rs +++ b/src/commands/update.rs @@ -28,6 +28,13 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { // Aborts with an error if this installation is not updatable. assert_updatable()?; + // It's not currently possible to easily mock I/O with `trycmd`, + // but verifying that `execute` is not panicking, is good enough for now. + if env::var("SENTRY_INTEGRATION_TEST").is_ok() { + println!("Running in integration tests mode. Skipping execution."); + return Ok(()); + } + let exe = env::current_exe()?; let update = get_latest_sentrycli_release() .with_context(|| "Error getting latest Sentry CLI version.")?; @@ -37,13 +44,6 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { println!("Latest release is {}", update.latest_version()); - // It's not currently possible to easily mock I/O with `trycmd`, - // but verifying that `execute` is not panicking, is good enough for now. - if env::var("SENTRY_INTEGRATION_TEST").is_ok() { - println!("Running in integration tests mode. Skipping execution."); - return Ok(()); - } - if update.is_latest_version() { if matches.get_flag("force") { println!("Forcing update"); diff --git a/tests/integration/_cases/update/update.trycmd b/tests/integration/_cases/update/update.trycmd index 3cff0879b9..d1b7d17d09 100644 --- a/tests/integration/_cases/update/update.trycmd +++ b/tests/integration/_cases/update/update.trycmd @@ -1,7 +1,6 @@ ``` $ sentry-cli update ? success -Latest release is [..] Running in integration tests mode. Skipping execution. ```