-
Notifications
You must be signed in to change notification settings - Fork 1
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 #70 from momentohq/chore/resource-exhausted-msg
chore: modify resource exhausted message using metadata and add messa…
- Loading branch information
Showing
4 changed files
with
101 additions
and
12 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/androidInstrumentedTest/kotlin/software/momento/kotlin/sdk/LimitExceededExceptionTest.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,23 @@ | ||
package software.momento.kotlin.sdk | ||
|
||
|
||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.filters.LargeTest | ||
import kotlinx.coroutines.test.runTest | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
@LargeTest | ||
class LimitExceededExceptionTest: BaseAndroidTestClass() { | ||
|
||
@Test | ||
fun shouldFailWithResourceExhaustedMessage() = runTest { | ||
val key = "cache"; | ||
val value = 'x'.toString().repeat(5_300_000) // 5.3MB | ||
|
||
val setResponse = cacheClient.set(cacheName, key, value) | ||
val stringifiedResponse = setResponse.toString() | ||
assert(stringifiedResponse.contains("Request size limit exceeded for this account")) | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/jvmTest/kotlin/software/momento/kotlin/sdk/LimitExceededExceptionTest.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,17 @@ | ||
package software.momento.kotlin.sdk | ||
|
||
import kotlinx.coroutines.test.runTest | ||
import kotlin.test.Test | ||
|
||
class LimitExceededExceptionTest: BaseJvmTestClass() { | ||
|
||
@Test | ||
fun shouldFailWithResourceExhaustedMessage() = runTest { | ||
val key = "cache"; | ||
val value = 'x'.toString().repeat(5_300_000) // 5.3MB | ||
|
||
val setResponse = cacheClient.set(cacheName, key, value) | ||
val stringifiedResponse = setResponse.toString() | ||
assert(stringifiedResponse.contains("Request size limit exceeded for this account")) | ||
} | ||
} |