From 2a767c1e1823bd9e02f3954e8f7941b6763b0e0b Mon Sep 17 00:00:00 2001 From: andrew-signal Date: Mon, 17 Mar 2025 07:10:00 -0400 Subject: [PATCH] Fix races causing flakes in LibSignalChatConnectionTest. --- .../internal/websocket/LibSignalChatConnectionTest.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libsignal-service/src/test/java/org/whispersystems/signalservice/internal/websocket/LibSignalChatConnectionTest.kt b/libsignal-service/src/test/java/org/whispersystems/signalservice/internal/websocket/LibSignalChatConnectionTest.kt index d117cc0576..1221a72f27 100644 --- a/libsignal-service/src/test/java/org/whispersystems/signalservice/internal/websocket/LibSignalChatConnectionTest.kt +++ b/libsignal-service/src/test/java/org/whispersystems/signalservice/internal/websocket/LibSignalChatConnectionTest.kt @@ -420,10 +420,8 @@ class LibSignalChatConnectionTest { var connectionCompletionFuture: CompletableFuture? = null every { network.connectUnauthChat(any()) } answers { chatListener = firstArg() - delay { - // We do not complete the future, so we stay in the CONNECTING state forever. - connectionCompletionFuture = it - } + connectionCompletionFuture = CompletableFuture() + connectionCompletionFuture!! } sendLatch = CountDownLatch(1) @@ -447,9 +445,8 @@ class LibSignalChatConnectionTest { var connectionCompletionFuture: CompletableFuture? = null every { network.connectUnauthChat(any()) } answers { chatListener = firstArg() - delay { - connectionCompletionFuture = it - } + connectionCompletionFuture = CompletableFuture() + connectionCompletionFuture!! } sendLatch = CountDownLatch(1)