-
-
Notifications
You must be signed in to change notification settings - Fork 465
Add tests for checking mixed versions #4292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
bd0c3b4
Check for mixed SDK versions
adinauer f50173b
Format code
getsentry-bot a8875cf
format + api
adinauer c0eea6a
Init noops if mixed versions detected
adinauer 5c09766
Add BuildConfig
adinauer 735ff28
config entries for agentless module sdk names
adinauer fe20321
Add MANIFEST.MF for JARs
adinauer 901830d
Throw on startup; use manifests for backend; reuse code for otel
adinauer 65a7a6f
Format code
getsentry-bot 62cb98f
Merge branch 'main' into feat/crash-on-startup-with-mixed-versions
adinauer 954610d
Format code
getsentry-bot 8144647
changelog
adinauer 7d1942e
api
adinauer f062c3e
Merge branch 'main' into feat/manifest-for-jars
adinauer e72dff6
changelog
adinauer 72c554b
Merge branch 'main' into feat/detect-mixed-sdk-versions
adinauer 60e4cd3
Merge branch 'feat/detect-mixed-sdk-versions' into feat/noop-on-mixed…
adinauer b1ae3b4
Merge branch 'feat/noop-on-mixed-versions-android' into feat/manifest…
adinauer e13f518
Merge branch 'feat/manifest-for-jars' into feat/crash-on-startup-with…
adinauer c3d50ab
Remove duplicate addPackage calls
adinauer 8185388
remove test assertion for package
adinauer f8ba72d
Introduce fatal SDK logger
adinauer e4d522f
Use Implementation-Version as raw version
adinauer 7def3ea
Add tests for checking mixed versions
adinauer 3b13d0d
Format code
getsentry-bot 5504ccb
Merge branch 'main' into feat/mixed-version-tests
adinauer 868ed6b
clear storage after test to not affect other tests
adinauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
sentry/src/test/java/io/sentry/SentryIntegrationPackageStorageTest.kt
This file contains hidden or 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,75 @@ | ||
| package io.sentry | ||
|
|
||
| import kotlin.test.AfterTest | ||
| import kotlin.test.Test | ||
| import kotlin.test.assertFalse | ||
| import kotlin.test.assertTrue | ||
|
|
||
| class SentryIntegrationPackageStorageTest { | ||
|
|
||
| @AfterTest | ||
| fun teardown() { | ||
| SentryIntegrationPackageStorage.getInstance().clearStorage() | ||
| } | ||
|
|
||
| @Test | ||
| fun `same package version is OK`() { | ||
| val storage = SentryIntegrationPackageStorage.getInstance() | ||
| storage.clearStorage() | ||
|
|
||
| storage.addPackage("maven:io.sentry:sentry", BuildConfig.VERSION_NAME) | ||
| storage.addPackage("maven:io.sentry:sentry-logback", BuildConfig.VERSION_NAME) | ||
|
|
||
| assertFalse(storage.checkForMixedVersions(SystemOutLogger())) | ||
| } | ||
|
|
||
| @Test | ||
| fun `checking twice works`() { | ||
| val storage = SentryIntegrationPackageStorage.getInstance() | ||
| storage.clearStorage() | ||
|
|
||
| storage.addPackage("maven:io.sentry:sentry", BuildConfig.VERSION_NAME) | ||
| storage.addPackage("maven:io.sentry:sentry-logback", BuildConfig.VERSION_NAME) | ||
|
|
||
| assertFalse(storage.checkForMixedVersions(SystemOutLogger())) | ||
| assertFalse(storage.checkForMixedVersions(SystemOutLogger())) | ||
| } | ||
|
|
||
| @Test | ||
| fun `checking twice with changes works`() { | ||
| val storage = SentryIntegrationPackageStorage.getInstance() | ||
| storage.clearStorage() | ||
|
|
||
| storage.addPackage("maven:io.sentry:sentry", BuildConfig.VERSION_NAME) | ||
| storage.addPackage("maven:io.sentry:sentry-logback", BuildConfig.VERSION_NAME) | ||
|
|
||
| assertFalse(storage.checkForMixedVersions(SystemOutLogger())) | ||
|
|
||
| storage.addPackage("maven:io.sentry:sentry-spring", "8.0.0") | ||
| assertTrue(storage.checkForMixedVersions(SystemOutLogger())) | ||
| } | ||
|
|
||
| @Test | ||
| fun `mixed package version is not OK`() { | ||
| val storage = SentryIntegrationPackageStorage.getInstance() | ||
| storage.clearStorage() | ||
|
|
||
| storage.addPackage("maven:io.sentry:sentry", BuildConfig.VERSION_NAME) | ||
| storage.addPackage("maven:io.sentry:sentry-logback", "8.0.0") | ||
|
|
||
| assertTrue(storage.checkForMixedVersions(SystemOutLogger())) | ||
| } | ||
|
|
||
| @Test | ||
| fun `only java sdk modules are checked`() { | ||
| val storage = SentryIntegrationPackageStorage.getInstance() | ||
| storage.clearStorage() | ||
|
|
||
| storage.addPackage("maven:io.sentry:sentry", BuildConfig.VERSION_NAME) | ||
| storage.addPackage("maven:io.sentry:sentry-logback", BuildConfig.VERSION_NAME) | ||
| storage.addPackage("maven:io.sentry.other:sentry-other", "1.0.0") | ||
| storage.addPackage("maven:io.opentelemetry.javaagent:opentelemetry-javaagent", "2.0.0") | ||
|
|
||
| assertFalse(storage.checkForMixedVersions(SystemOutLogger())) | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.