This is an automated email from the ASF dual-hosted git repository.

jamesfredley pushed a commit to branch fix/async-promise-spec-read-timeout
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 87a4e39c9d92ebf3fe7d213d247575d245f9385a
Author: James Fredley <[email protected]>
AuthorDate: Tue Mar 3 10:48:49 2026 -0500

    Fix flaky AsyncPromiseSpec ReadTimeoutException on CI
    
    Configure the Micronaut HttpClient with an explicit 30-second read
    timeout using DefaultHttpClientConfiguration. The default timeout
    is insufficient on loaded CI runners where Spring @Async thread pool
    startup on first invocation combined with processing overhead can
    exceed the client read timeout, causing intermittent
    ReadTimeoutException failures.
    
    This follows the same pattern already used in FlashChainForwardSpec
    for custom HttpClient configuration.
    
    Assisted-by: Claude Code <[email protected]>
---
 .../groovy/functionaltests/async/AsyncPromiseSpec.groovy          | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/grails-test-examples/app1/src/integration-test/groovy/functionaltests/async/AsyncPromiseSpec.groovy
 
b/grails-test-examples/app1/src/integration-test/groovy/functionaltests/async/AsyncPromiseSpec.groovy
index 43f3feb750..637e229ad4 100644
--- 
a/grails-test-examples/app1/src/integration-test/groovy/functionaltests/async/AsyncPromiseSpec.groovy
+++ 
b/grails-test-examples/app1/src/integration-test/groovy/functionaltests/async/AsyncPromiseSpec.groovy
@@ -19,6 +19,7 @@
 
 package functionaltests.async
 
+import java.time.Duration
 import java.util.concurrent.TimeUnit
 
 import groovy.json.JsonSlurper
@@ -27,6 +28,7 @@ import functionaltests.services.AsyncProcessingService
 import io.micronaut.http.HttpRequest
 import io.micronaut.http.HttpStatus
 import io.micronaut.http.MediaType
+import io.micronaut.http.client.DefaultHttpClientConfiguration
 import io.micronaut.http.client.HttpClient
 import spock.lang.Shared
 import spock.lang.Specification
@@ -47,7 +49,11 @@ class AsyncPromiseSpec extends Specification {
     AsyncProcessingService asyncProcessingService
 
     def setup() {
-        client = client ?: HttpClient.create(new 
URL("http://localhost:${serverPort}";))
+        if (!client) {
+            def config = new DefaultHttpClientConfiguration()
+            config.setReadTimeout(Duration.ofSeconds(30))
+            client = HttpClient.create(new 
URL("http://localhost:${serverPort}";), config)
+        }
     }
 
     def cleanupSpec() {

Reply via email to