From 097e82c1b00989df176df3cb3f409c9fcb757ab2 Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Mon, 11 Nov 2024 22:50:09 +0530 Subject: [PATCH] Added detach delay to fix test flakiness for channel detach --- .../src/test/java/com/ably/chat/RoomLifecycleManagerTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chat-android/src/test/java/com/ably/chat/RoomLifecycleManagerTest.kt b/chat-android/src/test/java/com/ably/chat/RoomLifecycleManagerTest.kt index 6f6cc73..d06765b 100644 --- a/chat-android/src/test/java/com/ably/chat/RoomLifecycleManagerTest.kt +++ b/chat-android/src/test/java/com/ably/chat/RoomLifecycleManagerTest.kt @@ -332,6 +332,7 @@ class RoomLifecycleManagerTest { val detachedChannels = mutableListOf() coEvery { any().detachCoroutine() } coAnswers { + delay(200) detachedChannels.add(firstArg()) } @@ -379,6 +380,7 @@ class RoomLifecycleManagerTest { var failDetachTimes = 5 val detachedChannels = mutableListOf() coEvery { any().detachCoroutine() } coAnswers { + delay(200) if (--failDetachTimes >= 0) { error("failed to detach channel") }