diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/InternalSentrySdkTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/InternalSentrySdkTest.kt index 332898e7607..79e965986a9 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/InternalSentrySdkTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/InternalSentrySdkTest.kt @@ -199,20 +199,16 @@ class InternalSentrySdkTest { @Test fun `current scope returns obj when scopes is active`() { - val options = SentryOptions().apply { - dsn = "https://key@uri/1234567" - } - Sentry.setCurrentScopes(createTestScopes(options)) + val fixture = Fixture() + fixture.init(context) val scope = InternalSentrySdk.getCurrentScope() assertNotNull(scope) } @Test fun `current scope returns a copy of the scope`() { - val options = SentryOptions().apply { - dsn = "https://key@uri/1234567" - } - Sentry.setCurrentScopes(createTestScopes(options)) + val fixture = Fixture() + fixture.init(context) Sentry.addBreadcrumb("test") Sentry.configureScope(ScopeType.CURRENT) { scope -> scope.addBreadcrumb(Breadcrumb("currentBreadcrumb")) } Sentry.configureScope(ScopeType.ISOLATION) { scope -> scope.addBreadcrumb(Breadcrumb("isolationBreadcrumb")) } diff --git a/sentry/src/main/java/io/sentry/Sentry.java b/sentry/src/main/java/io/sentry/Sentry.java index 89f96b0d11c..3091a925c41 100644 --- a/sentry/src/main/java/io/sentry/Sentry.java +++ b/sentry/src/main/java/io/sentry/Sentry.java @@ -284,10 +284,7 @@ private static synchronized void init( final IScope rootIsolationScope = new Scope(options); scopes.close(true); - globalScope.replaceOptions(options); - rootScopes = new Scopes(rootScope, rootIsolationScope, globalScope, "Sentry.init"); - getScopesStorage().set(rootScopes); - globalScope.bindClient(new SentryClient(options)); + globalScope.bindClient(new SentryClient(rootScopes.getOptions())); // If the executorService passed in the init is the same that was previously closed, we have to // set a new one