Skip to content

Commit

Permalink
Extend MDCReactorSpec's http client read timeout (#10031)
Browse files Browse the repository at this point in the history
This sets the read timeout of the main http client (which is manually
instantiated) used in MDCReactorSpec to 5 minutes, which is the same
as what is set for the dependency-injected clients used elsewhere
throughout the test.

This spec was frequently failing in CI with an HTTP read timeout error,
likely due to resource starvation on the CI job runner causing slow
responses from the embedded server that is used in the test.
  • Loading branch information
jeremyg484 authored Oct 26, 2023
1 parent 9dd5fa0 commit 9a26d74
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import io.micronaut.http.annotation.Header
import io.micronaut.http.annotation.Patch
import io.micronaut.http.annotation.Post
import io.micronaut.http.annotation.Put
import io.micronaut.http.client.DefaultHttpClientConfiguration
import io.micronaut.http.client.HttpClient
import io.micronaut.http.client.annotation.Client
import io.micronaut.http.filter.ClientFilterChain
Expand Down Expand Up @@ -55,7 +56,13 @@ class MDCReactorSpec extends Specification {

@Shared
@AutoCleanup
HttpClient client = HttpClient.create(embeddedServer.URL)
HttpClient client

def setup() {
def config = new DefaultHttpClientConfiguration()
config.setReadTimeout(Duration.ofMinutes(5))
client = HttpClient.create(embeddedServer.URL, config)
}

void "test MDC propagates"() {
expect:
Expand Down

0 comments on commit 9a26d74

Please sign in to comment.