From 02442c079c1b04396ed8a261ce9a6fe44a36a273 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 10 Jan 2025 22:03:39 +0100 Subject: [PATCH] Fix `ActivityLifecycleSpanHelperTest` by resetting `AppStartMetrics` (#4038) * fix test * Only initialize CodeQl for Java --------- Co-authored-by: Markus Hintersteiner --- .github/workflows/codeql-analysis.yml | 2 +- .../core/performance/ActivityLifecycleSpanHelperTest.kt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c4e60bcdab..30ad0b95d7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -41,7 +41,7 @@ jobs: - name: Initialize CodeQL uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # pin@v2 with: - languages: ${{ matrix.language }} + languages: 'java' - name: Build Java run: | diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/performance/ActivityLifecycleSpanHelperTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/performance/ActivityLifecycleSpanHelperTest.kt index 4ae35c0507..d1225c5aee 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/performance/ActivityLifecycleSpanHelperTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/performance/ActivityLifecycleSpanHelperTest.kt @@ -17,6 +17,7 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.whenever import java.util.Date import java.util.concurrent.TimeUnit +import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -48,6 +49,11 @@ class ActivityLifecycleSpanHelperTest { } private val fixture = Fixture() + @BeforeTest + fun setup() { + AppStartMetrics.getInstance().clear() + } + @Test fun `createAndStopOnCreateSpan creates and finishes onCreate span`() { val helper = fixture.getSut()