Skip to content

Commit

Permalink
Merge branch 'feat/observe-network' into feat/rate-limit-cached-envel…
Browse files Browse the repository at this point in the history
…opes
  • Loading branch information
markushi committed Sep 14, 2023
2 parents 2d9b842 + dcafe87 commit 782ced4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion sentry/src/test/java/io/sentry/cache/EnvelopeCacheTest.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.sentry.cache

import io.sentry.DateUtils
import io.sentry.Hint
import io.sentry.ILogger
import io.sentry.NoOpLogger
import io.sentry.SentryCrashLastRunState
Expand Down Expand Up @@ -74,7 +75,7 @@ class EnvelopeCacheTest {
fun `tolerates discarding unknown envelope`() {
val cache = fixture.getSUT()

cache.discard(SentryEnvelope.from(fixture.options.serializer, createSession(), null))
cache.discard(SentryEnvelope.from(fixture.options.serializer, createSession(), null), Hint())

// no exception thrown
}
Expand Down
19 changes: 12 additions & 7 deletions sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.sentry.transport

import io.sentry.CachedEvent
import io.sentry.Hint
import io.sentry.Sentry
import io.sentry.SentryEnvelope
import io.sentry.SentryEnvelopeHeader
import io.sentry.SentryEnvelopeItem
Expand Down Expand Up @@ -76,7 +77,7 @@ class AsyncHttpTransportTest {
order.verify(fixture.sentryOptions.envelopeDiskCache).store(eq(envelope), anyOrNull())

order.verify(fixture.connection).send(eq(envelope))
order.verify(fixture.sentryOptions.envelopeDiskCache).discard(eq(envelope))
order.verify(fixture.sentryOptions.envelopeDiskCache).discard(eq(envelope), any())
}

@Test
Expand Down Expand Up @@ -116,7 +117,7 @@ class AsyncHttpTransportTest {
order.verify(fixture.sentryOptions.envelopeDiskCache).store(eq(envelope), anyOrNull())

order.verify(fixture.connection).send(eq(envelope))
verify(fixture.sentryOptions.envelopeDiskCache, never()).discard(any())
verify(fixture.sentryOptions.envelopeDiskCache, never()).discard(any(), any())
}

@Test
Expand All @@ -137,7 +138,7 @@ class AsyncHttpTransportTest {
// then
val order = inOrder(fixture.connection, fixture.sentryOptions.envelopeDiskCache)
order.verify(fixture.connection).send(eq(envelope))
verify(fixture.sentryOptions.envelopeDiskCache, never()).discard(any())
verify(fixture.sentryOptions.envelopeDiskCache, never()).discard(any(), any())
}

@Test
Expand All @@ -152,6 +153,10 @@ class AsyncHttpTransportTest {

// then
verify(fixture.executor, never()).submit(any())

Sentry.withScope {
val installationId = it.user?.id
}
}

@Test
Expand Down Expand Up @@ -192,7 +197,7 @@ class AsyncHttpTransportTest {
fixture.getSUT().send(envelope, hints)

// then
verify(fixture.sentryOptions.envelopeDiskCache).discard(any())
verify(fixture.sentryOptions.envelopeDiskCache).discard(any(), any())
}

@Test
Expand All @@ -205,7 +210,7 @@ class AsyncHttpTransportTest {
fixture.getSUT().send(envelope)

// then
verify(fixture.sentryOptions.envelopeDiskCache, never()).discard(any())
verify(fixture.sentryOptions.envelopeDiskCache, never()).discard(any(), any())
}

@Test
Expand Down Expand Up @@ -250,7 +255,7 @@ class AsyncHttpTransportTest {
fixture.getSUT().send(envelope, hints)

// then
verify(fixture.sentryOptions.envelopeDiskCache).discard(any())
verify(fixture.sentryOptions.envelopeDiskCache).discard(any(), any())
}

@Test
Expand All @@ -264,7 +269,7 @@ class AsyncHttpTransportTest {
fixture.getSUT().send(envelope)

// then
verify(fixture.sentryOptions.envelopeDiskCache, never()).discard(any())
verify(fixture.sentryOptions.envelopeDiskCache, never()).discard(any(), any())
}

@Test
Expand Down

0 comments on commit 782ced4

Please sign in to comment.