-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1327 from embrace-io/fix-session-retry-logic
Retry session delivery where possible
- Loading branch information
Showing
6 changed files
with
46 additions
and
24 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
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
21 changes: 21 additions & 0 deletions
21
...id-core/src/test/java/io/embrace/android/embracesdk/internal/comms/api/ApiResponseTest.kt
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.embrace.android.embracesdk.internal.comms.api | ||
|
||
import org.junit.Assert.assertFalse | ||
import org.junit.Assert.assertTrue | ||
import org.junit.Test | ||
|
||
internal class ApiResponseTest { | ||
|
||
@Test | ||
fun `test retry logic`() { | ||
assertFalse(ApiResponse.Success(null, null).shouldRetry) | ||
assertFalse(ApiResponse.NotModified.shouldRetry) | ||
assertFalse(ApiResponse.PayloadTooLarge.shouldRetry) | ||
assertFalse(ApiResponse.Failure(400, null).shouldRetry) | ||
|
||
assertTrue(ApiResponse.TooManyRequests(Endpoint.EVENTS, null).shouldRetry) | ||
assertTrue(ApiResponse.Incomplete(RuntimeException()).shouldRetry) | ||
assertTrue(ApiResponse.None.shouldRetry) | ||
assertTrue(ApiResponse.Failure(500, null).shouldRetry) | ||
} | ||
} |
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