Skip to content

Commit

Permalink
Update to the latest Momento SDK
Browse files Browse the repository at this point in the history
Use ubuntu 22.04 instead of ubuntu latest for running the android tests
because the emulator runner has issues on 24.04
ReactiveCircus/android-emulator-runner#400

Add some improved test failure messages.
  • Loading branch information
nand4011 committed Jul 10, 2024
1 parent b5735ec commit 10a857e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ jobs:
arguments: clean build

android:
# The Android emulator only has hardware acceleration on macOS.
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
api-level: [ 23 ]
Expand Down
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ kotlin {
val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("software.momento.kotlin:client-protos-jvm:0.100.0")
implementation("software.momento.kotlin:client-protos-jvm:0.114.0")
runtimeOnly("io.grpc:grpc-netty:1.57.2")
}
}
Expand All @@ -74,7 +74,7 @@ kotlin {
}
val androidMain by getting {
dependencies {
implementation("software.momento.kotlin:client-protos-android:0.100.0")
implementation("software.momento.kotlin:client-protos-android:0.114.0")
runtimeOnly("io.grpc:grpc-okhttp:1.57.2")
}
}
Expand All @@ -88,8 +88,8 @@ kotlin {
dependencies {
implementation(kotlin("test-junit"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
implementation("androidx.test.ext:junit:1.1.5")
implementation("androidx.test.espresso:espresso-core:3.5.1")
implementation("androidx.test.ext:junit:1.2.1")
implementation("androidx.test.espresso:espresso-core:3.6.1")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ class CacheClientScalarTest: BaseAndroidTestClass() {
val value = "cache-value"

var getResponse = cacheClient.get(cacheName, key)
assert(getResponse is GetResponse.Miss)
assert(getResponse is GetResponse.Miss) { "expected Miss, got $getResponse" }

val setResponse = cacheClient.set(cacheName, key, value)
assert(setResponse is SetResponse.Success)
assert(setResponse is SetResponse.Success) { "expected Success, got $setResponse" }

getResponse = cacheClient.get(cacheName, key)
assert((getResponse as GetResponse.Hit).value == value)

val deleteResponse = cacheClient.delete(cacheName, key)
assert(deleteResponse is DeleteResponse.Success)
assert(deleteResponse is DeleteResponse.Success) { "expected Success, got $deleteResponse" }

getResponse = cacheClient.get(cacheName, key)
assert(getResponse is GetResponse.Miss)
assert(getResponse is GetResponse.Miss) { "expected Miss, got $getResponse" }
}

@Test
Expand All @@ -59,18 +59,18 @@ class CacheClientScalarTest: BaseAndroidTestClass() {
val value = "cache-value".encodeToByteArray()

var getResponse = cacheClient.get(cacheName, key)
assert(getResponse is GetResponse.Miss)
assert(getResponse is GetResponse.Miss) { "expected Miss, got $getResponse" }

val setResponse = cacheClient.set(cacheName, key, value)
assert(setResponse is SetResponse.Success)
assert(setResponse is SetResponse.Success) { "expected Miss, got $setResponse" }

getResponse = cacheClient.get(cacheName, key)
assert((getResponse as GetResponse.Hit).valueByteArray.contentEquals(value))

val deleteResponse = cacheClient.delete(cacheName, key)
assert(deleteResponse is DeleteResponse.Success)
assert(deleteResponse is DeleteResponse.Success) { "expected Success, got $getResponse" }

getResponse = cacheClient.get(cacheName, key)
assert(getResponse is GetResponse.Miss)
assert(getResponse is GetResponse.Miss) { "expected Miss, got $getResponse" }
}
}

0 comments on commit 10a857e

Please sign in to comment.