From d572610734a5ab98532f0aee55e87a577c4eba16 Mon Sep 17 00:00:00 2001 From: hippi345 <13539685+hippi345@users.noreply.github.com> Date: Thu, 29 Oct 2026 21:31:17 -0400 Subject: [PATCH] Loosen the upper bound in SocketTest timeout tests readTimeout failed on CI at 825 ms against a 750 ms cap. Keep the 250 ms lower bound, which checks that the timeout doesn't fire early, and only use the upper bound to catch a hang. writeTimeout has the same bound and gets the same change. Closes #1886 --- okio/src/jvmTest/kotlin/okio/SocketTest.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/okio/src/jvmTest/kotlin/okio/SocketTest.kt b/okio/src/jvmTest/kotlin/okio/SocketTest.kt index 8fb3f288f7..b6d45e6c21 100644 --- a/okio/src/jvmTest/kotlin/okio/SocketTest.kt +++ b/okio/src/jvmTest/kotlin/okio/SocketTest.kt @@ -32,6 +32,7 @@ import javax.net.SocketFactory import kotlin.concurrent.thread import kotlin.test.assertFailsWith import kotlin.time.Duration.Companion.milliseconds +import kotlin.time.Duration.Companion.seconds import kotlin.time.measureTime import okio.internal.DefaultSocket import org.junit.jupiter.api.AfterEach @@ -163,7 +164,9 @@ class SocketTest(val factory: Factory = Factory.Default) { } } - assertThat(duration).isBetween(250.milliseconds, 750.milliseconds) + // The upper bound only guards against a hang; a loaded CI machine can take well over the + // 500 ms timeout to deliver the interrupt. + assertThat(duration).isBetween(250.milliseconds, 2.seconds) } /** Make a large-enough write to saturate the outgoing write buffer. */ @@ -178,7 +181,9 @@ class SocketTest(val factory: Factory = Factory.Default) { } } - assertThat(duration).isBetween(250.milliseconds, 750.milliseconds) + // The upper bound only guards against a hang; a loaded CI machine can take well over the + // 500 ms timeout to deliver the interrupt. + assertThat(duration).isBetween(250.milliseconds, 2.seconds) } @Test