Fix races causing flakes in LibSignalChatConnectionTest.

This commit is contained in:
andrew-signal
2025-03-17 07:10:00 -04:00
committed by Cody Henthorne
parent d3f622478f
commit 2a767c1e18

View File

@@ -420,10 +420,8 @@ class LibSignalChatConnectionTest {
var connectionCompletionFuture: CompletableFuture<UnauthenticatedChatConnection>? = 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<UnauthenticatedChatConnection>()
connectionCompletionFuture!!
}
sendLatch = CountDownLatch(1)
@@ -447,9 +445,8 @@ class LibSignalChatConnectionTest {
var connectionCompletionFuture: CompletableFuture<UnauthenticatedChatConnection>? = null
every { network.connectUnauthChat(any()) } answers {
chatListener = firstArg()
delay {
connectionCompletionFuture = it
}
connectionCompletionFuture = CompletableFuture<UnauthenticatedChatConnection>()
connectionCompletionFuture!!
}
sendLatch = CountDownLatch(1)