From 10a857eb91f654c59f73a7596aafd727e2ba51c6 Mon Sep 17 00:00:00 2001 From: Nate Anderson Date: Wed, 10 Jul 2024 12:02:48 -0700 Subject: [PATCH] Update to the latest Momento SDK Use ubuntu 22.04 instead of ubuntu latest for running the android tests because the emulator runner has issues on 24.04 https://github.com/ReactiveCircus/android-emulator-runner/issues/400 Add some improved test failure messages. --- .github/workflows/ci.yml | 3 +-- build.gradle.kts | 8 ++++---- .../momento/kotlin/sdk/CacheClientScalarTest.kt | 16 ++++++++-------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f404696..a4db87e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 ] diff --git a/build.gradle.kts b/build.gradle.kts index 6c4d9ff..d3a3265 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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") } } @@ -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") } } @@ -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") } } } diff --git a/src/androidInstrumentedTest/kotlin/software/momento/kotlin/sdk/CacheClientScalarTest.kt b/src/androidInstrumentedTest/kotlin/software/momento/kotlin/sdk/CacheClientScalarTest.kt index 3dacfb7..e1fb656 100644 --- a/src/androidInstrumentedTest/kotlin/software/momento/kotlin/sdk/CacheClientScalarTest.kt +++ b/src/androidInstrumentedTest/kotlin/software/momento/kotlin/sdk/CacheClientScalarTest.kt @@ -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 @@ -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" } } }