From e491e2e98928fd78134d61f74d005d487d4b5b1f Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Fri, 6 Feb 2026 14:56:41 +0100 Subject: [PATCH 1/2] fix(tests): Make test harness more resilient --- .../core/DefaultAndroidEventProcessorTest.kt | 2 + .../metrics-test.yml | 4 +- .../android/benchmark/SentryBenchmarkTest.kt | 45 ------------------- 3 files changed, 4 insertions(+), 47 deletions(-) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt index f1359ae6a37..091a75e1295 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt @@ -31,6 +31,7 @@ import io.sentry.test.getCtor import io.sentry.util.HintUtils import java.util.Locale import kotlin.test.BeforeTest +import kotlin.test.Ignore import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFailsWith @@ -488,6 +489,7 @@ class DefaultAndroidEventProcessorTest { } @Test + @Ignore("This test is flaky due to shared CpuInfoUtils instance") fun `Event sets no device cpu info when there is none provided`() { val sut = fixture.getSut(context) sut.deviceInfoUtil?.get() diff --git a/sentry-android-integration-tests/metrics-test.yml b/sentry-android-integration-tests/metrics-test.yml index c6b3fdd54de..9842063d58b 100644 --- a/sentry-android-integration-tests/metrics-test.yml +++ b/sentry-android-integration-tests/metrics-test.yml @@ -12,5 +12,5 @@ startupTimeTest: diffMax: 150 binarySizeTest: - diffMin: 500 KiB - diffMax: 700 KiB + diffMin: 600 KiB + diffMax: 850 KiB diff --git a/sentry-android-integration-tests/sentry-uitest-android-benchmark/src/androidTest/java/io/sentry/uitest/android/benchmark/SentryBenchmarkTest.kt b/sentry-android-integration-tests/sentry-uitest-android-benchmark/src/androidTest/java/io/sentry/uitest/android/benchmark/SentryBenchmarkTest.kt index f2066577c6e..453e79441fe 100644 --- a/sentry-android-integration-tests/sentry-uitest-android-benchmark/src/androidTest/java/io/sentry/uitest/android/benchmark/SentryBenchmarkTest.kt +++ b/sentry-android-integration-tests/sentry-uitest-android-benchmark/src/androidTest/java/io/sentry/uitest/android/benchmark/SentryBenchmarkTest.kt @@ -12,9 +12,7 @@ import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.runner.AndroidJUnitRunner import io.sentry.ITransaction -import io.sentry.Sentry import io.sentry.Sentry.OptionsConfiguration -import io.sentry.SentryOptions import io.sentry.android.core.SentryAndroid import io.sentry.android.core.SentryAndroidOptions import io.sentry.test.applyTestOptions @@ -71,49 +69,6 @@ class SentryBenchmarkTest : BaseBenchmarkTest() { // respectively. } - @Test - fun benchmarkProfiledTransaction() { - // We compare the same operation with and without profiled transaction. - // We expect the profiled transaction operation to be slower, but not slower than 5%. - val benchmarkOperationNoTransaction = - BenchmarkOperation(choreographer, op = getOperation(runner)) - val benchmarkOperationProfiled = - BenchmarkOperation( - choreographer, - before = { - runner.runOnMainSync { - initForTest(context) { options: SentryOptions -> - options.dsn = "https://key@uri/1234567" - options.tracesSampleRate = 1.0 - options.profilesSampleRate = 1.0 - options.isEnableAutoSessionTracking = false - } - } - }, - op = getOperation(runner) { Sentry.startTransaction("Benchmark", "ProfiledTransaction") }, - after = { runner.runOnMainSync { Sentry.close() } }, - ) - val refreshRate = BenchmarkActivity.refreshRate ?: 60F - val comparisonResults = - BenchmarkOperation.compare( - benchmarkOperationNoTransaction, - "NoTransaction", - benchmarkOperationProfiled, - "ProfiledTransaction", - refreshRate, - measuredIterations = 40, - ) - comparisonResults.printAllRuns("Profiling Benchmark") - val comparisonResult = comparisonResults.getSummaryResult() - comparisonResult.printResults() - - // Currently we just want to assert the cpu overhead - assertTrue( - comparisonResult.cpuTimeIncreasePercentage in 0F..5.5F, - "Expected ${comparisonResult.cpuTimeIncreasePercentage} to be in range 0 < x < 5.5", - ) - } - /** * Operation that will be compared: it launches [BenchmarkActivity], swipe the list and closes it. * The [transactionBuilder] is used to create the transaction before the swipes. From 7277e52a5a1e8205afe97fa0d006579d1b042d2c Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Fri, 6 Feb 2026 15:05:54 +0100 Subject: [PATCH 2/2] Remove unused fun --- .../android/benchmark/SentryBenchmarkTest.kt | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/sentry-android-integration-tests/sentry-uitest-android-benchmark/src/androidTest/java/io/sentry/uitest/android/benchmark/SentryBenchmarkTest.kt b/sentry-android-integration-tests/sentry-uitest-android-benchmark/src/androidTest/java/io/sentry/uitest/android/benchmark/SentryBenchmarkTest.kt index 453e79441fe..05a50895f25 100644 --- a/sentry-android-integration-tests/sentry-uitest-android-benchmark/src/androidTest/java/io/sentry/uitest/android/benchmark/SentryBenchmarkTest.kt +++ b/sentry-android-integration-tests/sentry-uitest-android-benchmark/src/androidTest/java/io/sentry/uitest/android/benchmark/SentryBenchmarkTest.kt @@ -1,6 +1,5 @@ package io.sentry.uitest.android.benchmark -import android.content.Context import android.os.Bundle import androidx.lifecycle.Lifecycle import androidx.test.core.app.launchActivity @@ -12,10 +11,6 @@ import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.runner.AndroidJUnitRunner import io.sentry.ITransaction -import io.sentry.Sentry.OptionsConfiguration -import io.sentry.android.core.SentryAndroid -import io.sentry.android.core.SentryAndroidOptions -import io.sentry.test.applyTestOptions import io.sentry.uitest.android.benchmark.util.BenchmarkOperation import kotlin.test.AfterTest import kotlin.test.BeforeTest @@ -104,13 +99,3 @@ class SentryBenchmarkTest : BaseBenchmarkTest() { } } } - -fun initForTest( - context: Context, - optionsConfiguration: OptionsConfiguration, -) { - SentryAndroid.init(context) { - applyTestOptions(it) - optionsConfiguration.configure(it) - } -}