Add connection timeout to SpringWebInstrumentationTest
MODIFY
instrumentation/spring/spring-web-3.1/library/src/test/groovy/SpringWebInstrumentationTest.groovy
instrumentation/spring/spring-web-3.1/library/src/test/groovy/SpringWebInstrumentationTest.groovy
@@ -12,6 +12,7 @@ import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
+import org.springframework.http.client.SimpleClientHttpRequestFactory
import org.springframework.web.client.ResourceAccessException
import org.springframework.web.client.RestTemplate
import spock.lang.Shared
@@ -22,7 +23,9 @@ class SpringWebInstrumentationTest extends HttpClientTest<HttpEntity<String>> im
def setupSpec() {
if (restTemplate == null) {
- restTemplate = new RestTemplate()
+ def requestFactory = new SimpleClientHttpRequestFactory()
+ requestFactory.setConnectTimeout(CONNECT_TIMEOUT_MS)
+ restTemplate = new RestTemplate(requestFactory)
restTemplate.getInterceptors().add(SpringWebTelemetry.create(getOpenTelemetry()).newInterceptor())
}
}

Add connection timeout to SpringWebInstrumentationTest (#5745)