From 1ad57ad5c86cea052a2bc13c676b366b77d92a03 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Fri, 25 Jul 2025 04:11:42 +0000 Subject: [PATCH 1/2] dataconnect: re-enable tests for user-defined enums as primary keys. The data connect emulator v2.10.1 has the fix for the crash b/432793533 and was included in firebase-tools release https://github.com/firebase/firebase-tools/releases/tag/v14.11.1 --- .../dataconnect/connectors/demo/EnumIntegrationTest.kt | 9 ++------- .../emulator/dataconnect/connector/demo/demo_ops.gql | 7 +++---- .../google/firebase/dataconnect/EnumIntegrationTest.kt | 5 ----- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/firebase-dataconnect/connectors/src/androidTest/kotlin/com/google/firebase/dataconnect/connectors/demo/EnumIntegrationTest.kt b/firebase-dataconnect/connectors/src/androidTest/kotlin/com/google/firebase/dataconnect/connectors/demo/EnumIntegrationTest.kt index 2bfa71fa77d..e4f3026de9f 100644 --- a/firebase-dataconnect/connectors/src/androidTest/kotlin/com/google/firebase/dataconnect/connectors/demo/EnumIntegrationTest.kt +++ b/firebase-dataconnect/connectors/src/androidTest/kotlin/com/google/firebase/dataconnect/connectors/demo/EnumIntegrationTest.kt @@ -429,18 +429,13 @@ class EnumIntegrationTest : DemoConnectorIntegrationTestBase() { ////////////////////////////////////////////////////////////////////////////////////////////////// @Test - @Ignore( - "TODO(b/432793533) Re-enable this test once the emulator crash " + - "caused by the \"EnumKey_GetByKey\" query is fixed." - ) fun enumAsPrimaryKey() = runTest { N5ekmae3jn.entries.forEach { enumValue -> val tagValue = Arb.dataConnect.tag().next(rs) val key = connector.enumKeyInsert.execute(enumValue) { tag = tagValue }.data.key withClue(key) { key.enumValue shouldBe Known(enumValue) } - // TODO(b/432793533): Uncomment once the "EnumKey_GetByKey" query is uncommented. - // val queryResult = connector.enumKeyGetByKey.execute(key).data - // withClue(queryResult) { queryResult.item?.tag shouldBe tagValue } + val queryResult = connector.enumKeyGetByKey.execute(key).data + withClue(queryResult) { queryResult.item?.tag shouldBe tagValue } } } diff --git a/firebase-dataconnect/emulator/dataconnect/connector/demo/demo_ops.gql b/firebase-dataconnect/emulator/dataconnect/connector/demo/demo_ops.gql index 231a0991214..57ce2f4abaa 100644 --- a/firebase-dataconnect/emulator/dataconnect/connector/demo/demo_ops.gql +++ b/firebase-dataconnect/emulator/dataconnect/connector/demo/demo_ops.gql @@ -1778,10 +1778,9 @@ mutation EnumKey_Insert($enumValue: N5ekmae3jn!, $tag: String) @auth(level: PUBL key: enumKey_insert(data: { enumValue: $enumValue, tag: $tag }) } -# TODO(b/432793533) Uncomment once the emulator crash caused by this query is fixed. -#query EnumKey_GetByKey($key: EnumKey_Key!) @auth(level: PUBLIC) { -# item: enumKey(key: $key) { tag } -#} +query EnumKey_GetByKey($key: EnumKey_Key!) @auth(level: PUBLIC) { + item: enumKey(key: $key) { tag } +} ############################################################################### # Operations for table: type MultipleEnumColumns diff --git a/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/EnumIntegrationTest.kt b/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/EnumIntegrationTest.kt index fcda65ec57d..31ffa642033 100644 --- a/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/EnumIntegrationTest.kt +++ b/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/EnumIntegrationTest.kt @@ -35,7 +35,6 @@ import io.kotest.property.checkAll import kotlinx.coroutines.test.runTest import kotlinx.serialization.Serializable import kotlinx.serialization.serializer -import org.junit.Ignore import org.junit.Test class EnumIntegrationTest : DataConnectIntegrationTestBase() { @@ -605,10 +604,6 @@ class EnumIntegrationTest : DataConnectIntegrationTestBase() { ////////////////////////////////////////////////////////////////////////////////////////////////// @Test - @Ignore( - "TODO(b/432793533) Re-enable this test once the emulator crash " + - "caused by the \"EnumKey_GetByKey\" query is fixed." - ) fun enumAsPrimaryKey() = runTest { N5ekmae3jn.entries.forEach { enumValue -> val tag = Arb.dataConnect.tag().next(rs) From 01a530abefb28d2be416e844379be0acd36ab0df Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Fri, 25 Jul 2025 05:36:54 +0000 Subject: [PATCH 2/2] fix failing test --- .../firebase/dataconnect/connectors/demo/EnumIntegrationTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firebase-dataconnect/connectors/src/androidTest/kotlin/com/google/firebase/dataconnect/connectors/demo/EnumIntegrationTest.kt b/firebase-dataconnect/connectors/src/androidTest/kotlin/com/google/firebase/dataconnect/connectors/demo/EnumIntegrationTest.kt index e4f3026de9f..73e373d6eb1 100644 --- a/firebase-dataconnect/connectors/src/androidTest/kotlin/com/google/firebase/dataconnect/connectors/demo/EnumIntegrationTest.kt +++ b/firebase-dataconnect/connectors/src/androidTest/kotlin/com/google/firebase/dataconnect/connectors/demo/EnumIntegrationTest.kt @@ -433,7 +433,7 @@ class EnumIntegrationTest : DemoConnectorIntegrationTestBase() { N5ekmae3jn.entries.forEach { enumValue -> val tagValue = Arb.dataConnect.tag().next(rs) val key = connector.enumKeyInsert.execute(enumValue) { tag = tagValue }.data.key - withClue(key) { key.enumValue shouldBe Known(enumValue) } + withClue(key) { key.enumValue shouldBe enumValue } val queryResult = connector.enumKeyGetByKey.execute(key).data withClue(queryResult) { queryResult.item?.tag shouldBe tagValue } }