-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not run sentry-cli commands if telemetry is disabled (#648)
* Do not run sentry-cli commands if telemetry is disabled * Changelog * Fix test
- Loading branch information
Showing
7 changed files
with
139 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 71 additions & 69 deletions
140
...-build/src/test/kotlin/io/sentry/android/gradle/integration/SentryPluginNonAndroidTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,73 @@ | ||
package io.sentry.android.gradle.integration | ||
|
||
// import kotlin.test.Test | ||
// import kotlin.test.assertTrue | ||
// import org.gradle.util.GradleVersion | ||
// | ||
// class SentryPluginNonAndroidTest : | ||
// BaseSentryNonAndroidPluginTest(GradleVersion.current().version) { | ||
// | ||
// @Test | ||
// fun `telemetry can be disabled`() { | ||
// appBuildFile.writeText( | ||
// // language=Groovy | ||
// """ | ||
// plugins { | ||
// id "java" | ||
// id "io.sentry.jvm.gradle" | ||
// } | ||
// | ||
// dependencies { | ||
// implementation 'org.springframework.boot:spring-boot-starter:3.0.0' | ||
// implementation 'ch.qos.logback:logback-classic:1.0.0' | ||
// implementation 'org.apache.logging.log4j:log4j-api:2.0' | ||
// implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2' | ||
// implementation 'org.postgresql:postgresql:42.6.0' | ||
// implementation 'com.graphql-java:graphql-java:17.3' | ||
// } | ||
// | ||
// sentry { | ||
// telemetry = false | ||
// } | ||
// """.trimIndent() | ||
// ) | ||
// | ||
// val result = runner | ||
// .appendArguments("app:assemble", "--debug") | ||
// .build() | ||
// | ||
// assertTrue(result.output) { "BUILD SUCCESSFUL" in result.output } | ||
// assertTrue(result.output) { "Sentry telemetry has been disabled." in result.output } | ||
// } | ||
// | ||
// @Test | ||
// fun `telemetry is enabled by default`() { | ||
// appBuildFile.writeText( | ||
// // language=Groovy | ||
// """ | ||
// plugins { | ||
// id "java" | ||
// id "io.sentry.jvm.gradle" | ||
// } | ||
// | ||
// dependencies { | ||
// implementation 'org.springframework.boot:spring-boot-starter:3.0.0' | ||
// implementation 'ch.qos.logback:logback-classic:1.0.0' | ||
// implementation 'org.apache.logging.log4j:log4j-api:2.0' | ||
// implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2' | ||
// implementation 'org.postgresql:postgresql:42.6.0' | ||
// implementation 'com.graphql-java:graphql-java:17.3' | ||
// } | ||
// """.trimIndent() | ||
// ) | ||
// | ||
// val result = runner | ||
// .appendArguments("app:assemble", "--info") | ||
// .build() | ||
// | ||
// assertTrue(result.output) { "BUILD SUCCESSFUL" in result.output } | ||
// assertTrue(result.output) { "Sentry telemetry is enabled." in result.output } | ||
// } | ||
// } | ||
import kotlin.test.Test | ||
import kotlin.test.assertFalse | ||
import kotlin.test.assertTrue | ||
import org.gradle.util.GradleVersion | ||
|
||
class SentryPluginNonAndroidTest : | ||
BaseSentryNonAndroidPluginTest(GradleVersion.current().version) { | ||
|
||
@Test | ||
fun `telemetry can be disabled`() { | ||
appBuildFile.writeText( | ||
// language=Groovy | ||
""" | ||
plugins { | ||
id "java" | ||
id "io.sentry.jvm.gradle" | ||
} | ||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter:3.0.0' | ||
implementation 'ch.qos.logback:logback-classic:1.0.0' | ||
implementation 'org.apache.logging.log4j:log4j-api:2.0' | ||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2' | ||
implementation 'org.postgresql:postgresql:42.6.0' | ||
implementation 'com.graphql-java:graphql-java:17.3' | ||
} | ||
sentry { | ||
telemetry = false | ||
} | ||
""".trimIndent() | ||
) | ||
|
||
val result = runner | ||
.appendArguments("app:assemble", "--info") | ||
.build() | ||
|
||
assertTrue(result.output) { "BUILD SUCCESSFUL" in result.output } | ||
assertTrue(result.output) { "Sentry telemetry has been disabled." in result.output } | ||
assertFalse(result.output) { "sentry-cli" in result.output } | ||
} | ||
|
||
@Test | ||
fun `telemetry is enabled by default`() { | ||
appBuildFile.writeText( | ||
// language=Groovy | ||
""" | ||
plugins { | ||
id "java" | ||
id "io.sentry.jvm.gradle" | ||
} | ||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter:3.0.0' | ||
implementation 'ch.qos.logback:logback-classic:1.0.0' | ||
implementation 'org.apache.logging.log4j:log4j-api:2.0' | ||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2' | ||
implementation 'org.postgresql:postgresql:42.6.0' | ||
implementation 'com.graphql-java:graphql-java:17.3' | ||
} | ||
""".trimIndent() | ||
) | ||
|
||
val result = runner | ||
.appendArguments("app:assemble", "--info") | ||
.build() | ||
|
||
assertTrue(result.output) { "BUILD SUCCESSFUL" in result.output } | ||
assertTrue(result.output) { "Sentry telemetry is enabled." in result.output } | ||
} | ||
} |
90 changes: 52 additions & 38 deletions
90
...n-build/src/test/kotlin/io/sentry/android/gradle/integration/SentryPluginTelemetryTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,54 @@ | ||
package io.sentry.android.gradle.integration | ||
|
||
// import io.sentry.BuildConfig | ||
// import kotlin.test.Ignore | ||
// import kotlin.test.Test | ||
// import kotlin.test.assertTrue | ||
// import org.gradle.util.GradleVersion | ||
// | ||
// class SentryPluginTelemetryTest : | ||
// BaseSentryPluginTest(BuildConfig.AgpVersion, GradleVersion.current().version) { | ||
// | ||
// @Test | ||
// fun `telemetry can be disabled`() { | ||
// appBuildFile.appendText( | ||
// // language=Groovy | ||
// """ | ||
// sentry { | ||
// telemetry = false | ||
// } | ||
// """.trimIndent() | ||
// ) | ||
// | ||
// val result = runner | ||
// .appendArguments("app:assembleDebug", "--debug") | ||
// .build() | ||
// | ||
// assertTrue(result.output) { "BUILD SUCCESSFUL" in result.output } | ||
// assertTrue(result.output) { "Sentry telemetry has been disabled." in result.output } | ||
// } | ||
// | ||
// @Test | ||
// fun `telemetry is enabled by default`() { | ||
// val result = runner | ||
// .appendArguments("app:assembleDebug", "--info") | ||
// .build() | ||
// | ||
// assertTrue(result.output) { "BUILD SUCCESSFUL" in result.output } | ||
// assertTrue(result.output) { "Sentry telemetry is enabled." in result.output } | ||
// } | ||
// } | ||
import io.sentry.BuildConfig | ||
import kotlin.test.Test | ||
import kotlin.test.assertFalse | ||
import kotlin.test.assertTrue | ||
import org.gradle.util.GradleVersion | ||
|
||
class SentryPluginTelemetryTest : | ||
BaseSentryPluginTest(BuildConfig.AgpVersion, GradleVersion.current().version) { | ||
|
||
@Test | ||
fun `telemetry can be disabled`() { | ||
appBuildFile.appendText( | ||
// language=Groovy | ||
""" | ||
sentry { | ||
telemetry = false | ||
} | ||
""".trimIndent() | ||
) | ||
|
||
val result = runner | ||
.appendArguments("app:assembleDebug", "--info") | ||
.build() | ||
|
||
assertTrue(result.output) { "BUILD SUCCESSFUL" in result.output } | ||
assertTrue(result.output) { "Sentry telemetry has been disabled." in result.output } | ||
assertFalse(result.output) { "sentry-cli" in result.output } | ||
} | ||
|
||
@Test | ||
fun `telemetry is enabled by default`() { | ||
appBuildFile.writeText( | ||
// language=Groovy | ||
""" | ||
plugins { | ||
id "com.android.application" | ||
id "io.sentry.android.gradle" | ||
} | ||
android { | ||
namespace 'com.example' | ||
} | ||
""".trimIndent() | ||
) | ||
val result = runner | ||
.appendArguments("app:assembleDebug", "--info") | ||
.build() | ||
|
||
assertTrue(result.output) { "BUILD SUCCESSFUL" in result.output } | ||
assertTrue(result.output) { "Sentry telemetry is enabled." in result.output } | ||
} | ||
} |