Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enha: sentry-cli Integration Tests (#371)
- Loading branch information
Showing
15 changed files
with
511 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: integration-tests-sentry-cli | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
pull_request: | ||
|
||
jobs: | ||
integration-test: | ||
runs-on: ubuntu-latest | ||
env: | ||
SENTRY_URL: http://127.0.0.1:8000 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10.5' | ||
|
||
- name: Start server and run integration test for sentry-cli commands | ||
run: | | ||
test/integration-test-server-start.sh & | ||
./gradlew -p plugin-build test --tests SentryPluginIntegrationTest |
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,6 +1,12 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.sampleapp"> | ||
<application> | ||
<activity android:name=".MainActivity"/> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<meta-data android:name="io.sentry.dsn" android:value="https://examplePublicKey@o0.ingest.sentry.io/0" /> | ||
</application> | ||
</manifest> |
90 changes: 90 additions & 0 deletions
90
plugin-build/src/test/kotlin/io/sentry/android/gradle/SentryPluginIntegrationTest.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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package io.sentry.android.gradle | ||
|
||
import kotlin.test.assertEquals | ||
import org.gradle.testkit.runner.TaskOutcome | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
|
||
@Suppress("FunctionName") | ||
@RunWith(Parameterized::class) | ||
class SentryPluginIntegrationTest( | ||
androidGradlePluginVersion: String, | ||
gradleVersion: String | ||
) : BaseSentryPluginTest(androidGradlePluginVersion, gradleVersion) { | ||
|
||
@Test | ||
fun uploadSentryProguardMappingsIntegration() { | ||
if (System.getenv("SENTRY_URL").isNullOrBlank()) { | ||
return // Don't run test if local test server endpoint is not set | ||
} | ||
applyAutoUploadProguardMapping() | ||
|
||
val build = runner | ||
.appendArguments(":app:assembleRelease") | ||
.build() | ||
|
||
assertEquals( | ||
build.task(":app:uploadSentryProguardMappingsRelease")?.outcome, | ||
TaskOutcome.SUCCESS | ||
) | ||
} | ||
|
||
@Test | ||
fun uploadNativeSymbols() { | ||
if (System.getenv("SENTRY_URL").isNullOrBlank()) { | ||
return // Don't run test if local test server endpoint is not set | ||
} | ||
applyUploadNativeSymbols() | ||
|
||
val build = runner | ||
.appendArguments(":app:assembleRelease") | ||
.build() | ||
|
||
assertEquals( | ||
build.task(":app:uploadSentryNativeSymbolsForRelease")?.outcome, | ||
TaskOutcome.SUCCESS | ||
) | ||
} | ||
|
||
private fun applyAutoUploadProguardMapping() { | ||
appBuildFile.writeText( | ||
// language=Groovy | ||
""" | ||
plugins { | ||
id "com.android.application" | ||
id "io.sentry.android.gradle" | ||
} | ||
sentry { | ||
includeProguardMapping = true | ||
autoUploadProguardMapping = true | ||
uploadNativeSymbols = false | ||
tracingInstrumentation { | ||
enabled = false | ||
} | ||
} | ||
""".trimIndent() | ||
) | ||
} | ||
|
||
private fun applyUploadNativeSymbols() { | ||
appBuildFile.writeText( | ||
// language=Groovy | ||
""" | ||
plugins { | ||
id "com.android.application" | ||
id "io.sentry.android.gradle" | ||
} | ||
sentry { | ||
autoUploadProguardMapping = false | ||
uploadNativeSymbols = true | ||
tracingInstrumentation { | ||
enabled = false | ||
} | ||
} | ||
""".trimIndent() | ||
) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.sample.app" | ||
android:versionCode="11" | ||
android:versionName="1.1.0" > | ||
|
||
<uses-sdk | ||
android:minSdkVersion="26" | ||
android:targetSdkVersion="32" /> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<queries> | ||
<package android:name="androidx.test.orchestrator" /> | ||
<package android:name="androidx.test.services" /> | ||
<package android:name="com.google.android.apps.common.testing.services" /> | ||
</queries> | ||
|
||
<application | ||
android:name="com.sample.app" | ||
android:allowBackup="true" | ||
android:appComponentFactory="androidx.core.app.CoreComponentFactory" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
android:extractNativeLibs="false" | ||
android:fullBackupContent="@xml/backup_rules" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.SampleApp" > | ||
<activity | ||
android:name="com.sample.app.MainActivity" | ||
android:exported="true" | ||
android:theme="@style/Theme.SampleApp" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<meta-data | ||
android:name="io.sentry.auto-init" | ||
android:value="false" /> | ||
|
||
<activity | ||
android:name="androidx.compose.ui.tooling.PreviewActivity" | ||
android:exported="true" /> <!-- 'android:authorities' must be unique in the device, across all apps --> | ||
<provider | ||
android:name="io.sentry.android.core.SentryInitProvider" | ||
android:authorities="com.sample.app.SentryInitProvider" | ||
android:exported="false" /> | ||
<provider | ||
android:name="io.sentry.android.core.SentryPerformanceProvider" | ||
android:authorities="com.sample.app.SentryPerformanceProvider" | ||
android:exported="false" | ||
android:initOrder="200" /> | ||
<provider | ||
android:name="androidx.startup.InitializationProvider" | ||
android:authorities="com.sample.app.androidx-startup" | ||
android:exported="false" > | ||
<meta-data | ||
android:name="androidx.emoji2.text.EmojiCompatInitializer" | ||
android:value="androidx.startup" /> | ||
<meta-data | ||
android:name="androidx.lifecycle.ProcessLifecycleInitializer" | ||
android:value="androidx.startup" /> | ||
<meta-data | ||
android:name="androidx.profileinstaller.ProfileInstallerInitializer" | ||
android:value="androidx.startup" /> | ||
</provider> | ||
|
||
<service | ||
android:name="androidx.room.MultiInstanceInvalidationService" | ||
android:directBootAware="true" | ||
android:exported="false" /> <!-- The activities will be merged into the manifest of the hosting app. --> | ||
<activity | ||
android:name="com.google.android.play.core.common.PlayCoreDialogWrapperActivity" | ||
android:exported="false" | ||
android:stateNotNeeded="true" | ||
android:theme="@style/Theme.PlayCore.Transparent" /> | ||
|
||
<meta-data | ||
android:name="com.google.android.gms.version" | ||
android:value="@integer/google_play_services_version" /> | ||
<meta-data | ||
android:name="com.google.android.play.billingclient.version" | ||
android:value="4.1.0" /> | ||
|
||
<activity | ||
android:name="com.android.billingclient.api.ProxyBillingActivity" | ||
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" | ||
android:exported="false" | ||
android:theme="@android:style/Theme.Translucent.NoTitleBar" /> | ||
|
||
<receiver | ||
android:name="androidx.profileinstaller.ProfileInstallReceiver" | ||
android:directBootAware="false" | ||
android:enabled="true" | ||
android:exported="true" | ||
android:permission="android.permission.DUMP" > | ||
<intent-filter> | ||
<action android:name="androidx.profileinstaller.action.INSTALL_PROFILE" /> | ||
</intent-filter> | ||
<intent-filter> | ||
<action android:name="androidx.profileinstaller.action.SKIP_FILE" /> | ||
</intent-filter> | ||
</receiver> | ||
</application> | ||
|
||
</manifest> |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"id": "fixture-id", | ||
"sha1": "fixture-sha1", | ||
"name": "fixture-name", | ||
"size": 1, | ||
"dist": null, | ||
"headers": { | ||
"fixture-header-key": "fixture-header-value" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[ | ||
{ | ||
"id": "6796495645", | ||
"name": "~/dist/bundle.min.js", | ||
"dist": "foo", | ||
"headers": { | ||
"Sourcemap": "dist/bundle.min.js.map" | ||
}, | ||
"size": 497, | ||
"sha1": "2fb719956748ab7ec5ae9bcb47606733f5589b72", | ||
"dateCreated": "2022-05-12T11:08:01.520199Z" | ||
}, | ||
{ | ||
"id": "6796495646", | ||
"name": "~/dist/bundle.min.js.map", | ||
"dist": "foo", | ||
"headers": {}, | ||
"size": 1522, | ||
"sha1": "f818059cbf617a8fae9b4e46d08f6c0246bb1624", | ||
"dateCreated": "2022-05-12T11:08:01.496220Z" | ||
} | ||
] |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"state": "ok", | ||
"missingChunks": [], | ||
"detail": null | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"associatedDsymFiles": [ | ||
{ | ||
"uuid": null, | ||
"debugId": null, | ||
"objectName": "fixture-objectName", | ||
"cpuName": "fixture-cpuName", | ||
"sha1": "fixture-sha1", | ||
"data": { | ||
"type": null, | ||
"features": ["fixture-feature"] | ||
} | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[ | ||
{ | ||
"uuid": null, | ||
"debugId": null, | ||
"objectName": "fixture-objectName", | ||
"cpuName": "fixture-cpuName", | ||
"sha1": "fixture-sha1", | ||
"data": { | ||
"type": null, | ||
"features": ["fixture-feature"] | ||
} | ||
} | ||
] |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"id": "1", | ||
"environment": "production", | ||
"dateStarted": null, | ||
"dateFinished": "2022-01-01T12:00:00.000000Z", | ||
"name": "fixture-deploy", | ||
"url": null | ||
} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"dateReleased": "2022-01-01T12:00:00.000000Z", | ||
"newGroups": 0, | ||
"commitCount": 0, | ||
"url": null, | ||
"data": | ||
{}, | ||
"lastDeploy": null, | ||
"deployCount": 0, | ||
"dateCreated": "2022-01-01T12:00:00.000000Z", | ||
"lastEvent": null, | ||
"version": "1.1.0", | ||
"firstEvent": null, | ||
"lastCommit": null, | ||
"shortVersion": "1.1.0", | ||
"authors": | ||
[], | ||
"owner": null, | ||
"versionInfo": | ||
{ | ||
"buildHash": null, | ||
"version": | ||
{ | ||
"raw": "1.1.0" | ||
}, | ||
"description": "1.1.0", | ||
"package": null | ||
}, | ||
"ref": null, | ||
"projects": | ||
[ | ||
{ | ||
"name": "Sentry Fastlane App", | ||
"platform": "ruby", | ||
"slug": "sentry-fastlane-plugin", | ||
"platforms": | ||
[ | ||
"ruby" | ||
], | ||
"newGroups": 0, | ||
"id": 1234567 | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[ | ||
{ | ||
"id": "1", | ||
"name": "sentry/sentry-fastlane-plugin", | ||
"url": null, | ||
"provider": { | ||
"id": "1", | ||
"name": "fixture-name" | ||
}, | ||
"status": "fixture-status", | ||
"dateCreated": "2022-01-01T12:00:00.000000Z" | ||
} | ||
] |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
python3 test/integration-test-server.py |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
curl http://127.0.0.1:8000/STOP |
Oops, something went wrong.