diff --git a/instrumentation/okhttp/okhttp-2.2/javaagent/src/test/groovy/OkHttp2Test.groovy b/instrumentation/okhttp/okhttp-2.2/javaagent/src/test/groovy/OkHttp2Test.groovy index 2bfee5affc..6cbb178290 100644 --- a/instrumentation/okhttp/okhttp-2.2/javaagent/src/test/groovy/OkHttp2Test.groovy +++ b/instrumentation/okhttp/okhttp-2.2/javaagent/src/test/groovy/OkHttp2Test.groovy @@ -25,6 +25,7 @@ class OkHttp2Test extends HttpClientTest implements AgentTestTrait { def setupSpec() { client.setConnectTimeout(CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS) + client.setReadTimeout(READ_TIMEOUT_MS, TimeUnit.MILLISECONDS) } @Override @@ -69,6 +70,7 @@ class OkHttp2Test extends HttpClientTest implements AgentTestTrait { switch (uri.toString()) { case "http://localhost:61/": case "https://192.0.2.1/": + case resolveAddress("/read-timeout").toString(): attributes.remove(SemanticAttributes.HTTP_FLAVOR) } @@ -79,4 +81,9 @@ class OkHttp2Test extends HttpClientTest implements AgentTestTrait { boolean testRedirects() { false } + + @Override + boolean testReadTimeout() { + true + } } diff --git a/instrumentation/okhttp/okhttp-3.0/testing/src/main/groovy/io/opentelemetry/instrumentation/okhttp/v3_0/AbstractOkHttp3Test.groovy b/instrumentation/okhttp/okhttp-3.0/testing/src/main/groovy/io/opentelemetry/instrumentation/okhttp/v3_0/AbstractOkHttp3Test.groovy index 96e731e0da..7b5d221e45 100644 --- a/instrumentation/okhttp/okhttp-3.0/testing/src/main/groovy/io/opentelemetry/instrumentation/okhttp/v3_0/AbstractOkHttp3Test.groovy +++ b/instrumentation/okhttp/okhttp-3.0/testing/src/main/groovy/io/opentelemetry/instrumentation/okhttp/v3_0/AbstractOkHttp3Test.groovy @@ -31,6 +31,7 @@ abstract class AbstractOkHttp3Test extends HttpClientTest { Call.Factory client = createCallFactory( new OkHttpClient.Builder() .connectTimeout(CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS) + .readTimeout(READ_TIMEOUT_MS, TimeUnit.MILLISECONDS) .protocols(Arrays.asList(Protocol.HTTP_1_1)) .retryOnConnectionFailure(false)) @@ -73,6 +74,11 @@ abstract class AbstractOkHttp3Test extends HttpClientTest { false } + @Override + boolean testReadTimeout() { + true + } + @Override Set> httpAttributes(URI uri) { Set> extra = [ @@ -85,6 +91,7 @@ abstract class AbstractOkHttp3Test extends HttpClientTest { switch (uri.toString()) { case "http://localhost:61/": case "https://192.0.2.1/": + case resolveAddress("/read-timeout").toString(): attributes.remove(SemanticAttributes.HTTP_FLAVOR) }