diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cee68f8c..04003ab3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ ktlint = "12.1.0" dokka = "1.9.20" kotlinx_serialization = "1.7.3" kotlinx_coroutines = "1.9.0" -pubnub = "10.4.1" +pubnub = "10.4.3" pubnub_swift = "8.3.1" [libraries] diff --git a/pubnub-chat-impl/src/commonTest/kotlin/com/pubnub/integration/BaseChatIntegrationTest.kt b/pubnub-chat-impl/src/commonTest/kotlin/com/pubnub/integration/BaseChatIntegrationTest.kt index 25c93107..687b5647 100644 --- a/pubnub-chat-impl/src/commonTest/kotlin/com/pubnub/integration/BaseChatIntegrationTest.kt +++ b/pubnub-chat-impl/src/commonTest/kotlin/com/pubnub/integration/BaseChatIntegrationTest.kt @@ -14,9 +14,11 @@ import com.pubnub.internal.PLATFORM import com.pubnub.test.BaseIntegrationTest import com.pubnub.test.await import com.pubnub.test.randomString +import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.launch +import kotlinx.coroutines.supervisorScope import kotlinx.coroutines.test.runTest import kotlinx.coroutines.withContext import kotlin.test.AfterTest @@ -131,38 +133,44 @@ abstract class BaseChatIntegrationTest : BaseIntegrationTest() { val userPamClient: User by lazy(LazyThreadSafetyMode.NONE) { chatPamClient.currentUser } @AfterTest - fun afterTest() = runTest { - try { - usersToRemove.forEach { - launch { - pubnub.removeUUIDMetadata(it).await() - } - } - if (PLATFORM != "iOS") { - usersToRemovePam.forEach { - launch { - pubnubPamServer.removeUUIDMetadata(it).await() + override fun after() { + runTest { + val exceptionHandler = CoroutineExceptionHandler { _, _ -> } + try { + supervisorScope { + usersToRemove.forEach { + launch(exceptionHandler) { + pubnub.removeUUIDMetadata(it).await() + } } - } - } - channelsToRemove.forEach { - launch { - pubnub.removeChannelMetadata(it).await() - } - } - if (PLATFORM != "iOS") { - channelsToRemovePam.forEach { - launch { - pubnubPamServer.removeChannelMetadata(it).await() + if (PLATFORM != "iOS") { + usersToRemovePam.forEach { + launch(exceptionHandler) { + pubnubPamServer.removeUUIDMetadata(it).await() + } + } + } + channelsToRemove.forEach { + launch(exceptionHandler) { + pubnub.removeChannelMetadata(it).await() + } + } + if (PLATFORM != "iOS") { + channelsToRemovePam.forEach { + launch(exceptionHandler) { + pubnubPamServer.removeChannelMetadata(it).await() + } + } } } + } finally { + chat.destroy() + chat02.destroy() + chatPamClient.destroy() + chatPamServer.destroy() } - } finally { - chat.destroy() - chat02.destroy() - chatPamClient.destroy() - chatPamServer.destroy() } + super.after() } internal suspend fun delayInMillis(timeMillis: Long) { diff --git a/pubnub-chat-test/src/commonMain/kotlin/com.pubnub.test/BaseIntegrationTest.kt b/pubnub-chat-test/src/commonMain/kotlin/com.pubnub.test/BaseIntegrationTest.kt index 5c048531..f4fdccb3 100644 --- a/pubnub-chat-test/src/commonMain/kotlin/com.pubnub.test/BaseIntegrationTest.kt +++ b/pubnub-chat-test/src/commonMain/kotlin/com.pubnub.test/BaseIntegrationTest.kt @@ -293,8 +293,6 @@ class PubNubTest( fun close() { pubNub.unsubscribeAll() - pubNub.destroy() - val remainingMessages = buildList { messageQueue.tryReceive().getOrNull()?.apply { add(this) } ?: return@buildList }