-
-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Don't set lastEventId for transactions (#1727)
Fixes #1709
- Loading branch information
1 parent
8f54d89
commit 06db34f
Showing
3 changed files
with
33 additions
and
2 deletions.
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
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
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 |
---|---|---|
|
@@ -927,6 +927,21 @@ class HubTest { | |
sut.captureEnvelope(envelope) | ||
verify(mockClient).captureEnvelope(any(), anyOrNull()) | ||
} | ||
|
||
@Test | ||
fun `when captureEnvelope is called, lastEventId is not set`() { | ||
val options = SentryOptions().apply { | ||
dsn = "https://[email protected]/proj" | ||
setSerializer(mock()) | ||
} | ||
val sut = Hub(options) | ||
val mockClient = mock<ISentryClient>() | ||
sut.bindClient(mockClient) | ||
whenever(mockClient.captureEnvelope(any(), anyOrNull())).thenReturn(SentryId()) | ||
val envelope = SentryEnvelope(SentryId(UUID.randomUUID()), null, setOf()) | ||
sut.captureEnvelope(envelope) | ||
assertEquals(SentryId.EMPTY_ID, sut.lastEventId) | ||
} | ||
//endregion | ||
|
||
//region startSession tests | ||
|
@@ -1078,6 +1093,22 @@ class HubTest { | |
verify(mockClient).captureTransaction(any(), eq(traceState), any(), eq(null)) | ||
} | ||
|
||
@Test | ||
fun `when captureTransaction is called, lastEventId is not set`() { | ||
val options = SentryOptions().apply { | ||
dsn = "https://[email protected]/proj" | ||
setSerializer(mock()) | ||
} | ||
val sut = Hub(options) | ||
val mockClient = mock<ISentryClient>() | ||
sut.bindClient(mockClient) | ||
whenever(mockClient.captureTransaction(anyOrNull(), anyOrNull(), anyOrNull(), anyOrNull())).thenReturn(SentryId()) | ||
|
||
val sentryTracer = SentryTracer(TransactionContext("name", "op", true), sut) | ||
sentryTracer.finish() | ||
assertEquals(SentryId.EMPTY_ID, sut.lastEventId) | ||
} | ||
|
||
@Test | ||
fun `when captureTransaction and transaction is not finished, captureTransaction on the client should not be called`() { | ||
val options = SentryOptions() | ||
|