Skip to content

Commit 75cdf96

Browse files
authored
dataconnect: QuerySubscriptionIntegrationTest.kt: fix flaky test using backgroundScope (#6827)
1 parent 3d41253 commit 75cdf96

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/QuerySubscriptionIntegrationTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,7 @@ class QuerySubscriptionIntegrationTest : DataConnectIntegrationTestBase() {
483483
val noName1Query =
484484
schema.getPerson(personId).withDataDeserializer(serializer<GetPersonDataNoName1>())
485485

486-
backgroundScope.launch { noName1Query.subscribe().flow.collect() }
487-
488-
noName1Query.execute()
486+
keepCacheAlive(noName1Query)
489487

490488
schema.updatePerson(id = personId, name = "Name1").execute()
491489

@@ -571,7 +569,7 @@ class QuerySubscriptionIntegrationTest : DataConnectIntegrationTestBase() {
571569
*/
572570
private suspend fun TestScope.keepCacheAlive(query: QueryRef<*, *>) {
573571
val cachePrimed = SuspendingFlag()
574-
backgroundScope.launch { query.subscribe().flow.onEach { cachePrimed.set() }.collect() }
572+
backgroundScope.launch { query.subscribe().flow.collect { cachePrimed.set() } }
575573
cachePrimed.await()
576574
}
577575

0 commit comments

Comments
 (0)