Enable read timeout tests in OkHTTP instrumentation (#4422)
This commit is contained in:
parent
538f2a7cd7
commit
13f28dca2a
|
@ -25,6 +25,7 @@ class OkHttp2Test extends HttpClientTest<Request> implements AgentTestTrait {
|
||||||
|
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
client.setConnectTimeout(CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS)
|
client.setConnectTimeout(CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS)
|
||||||
|
client.setReadTimeout(READ_TIMEOUT_MS, TimeUnit.MILLISECONDS)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,6 +70,7 @@ class OkHttp2Test extends HttpClientTest<Request> implements AgentTestTrait {
|
||||||
switch (uri.toString()) {
|
switch (uri.toString()) {
|
||||||
case "http://localhost:61/":
|
case "http://localhost:61/":
|
||||||
case "https://192.0.2.1/":
|
case "https://192.0.2.1/":
|
||||||
|
case resolveAddress("/read-timeout").toString():
|
||||||
attributes.remove(SemanticAttributes.HTTP_FLAVOR)
|
attributes.remove(SemanticAttributes.HTTP_FLAVOR)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,4 +81,9 @@ class OkHttp2Test extends HttpClientTest<Request> implements AgentTestTrait {
|
||||||
boolean testRedirects() {
|
boolean testRedirects() {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
boolean testReadTimeout() {
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ abstract class AbstractOkHttp3Test extends HttpClientTest<Request> {
|
||||||
Call.Factory client = createCallFactory(
|
Call.Factory client = createCallFactory(
|
||||||
new OkHttpClient.Builder()
|
new OkHttpClient.Builder()
|
||||||
.connectTimeout(CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS)
|
.connectTimeout(CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS)
|
||||||
|
.readTimeout(READ_TIMEOUT_MS, TimeUnit.MILLISECONDS)
|
||||||
.protocols(Arrays.asList(Protocol.HTTP_1_1))
|
.protocols(Arrays.asList(Protocol.HTTP_1_1))
|
||||||
.retryOnConnectionFailure(false))
|
.retryOnConnectionFailure(false))
|
||||||
|
|
||||||
|
@ -73,6 +74,11 @@ abstract class AbstractOkHttp3Test extends HttpClientTest<Request> {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
boolean testReadTimeout() {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Set<AttributeKey<?>> httpAttributes(URI uri) {
|
Set<AttributeKey<?>> httpAttributes(URI uri) {
|
||||||
Set<AttributeKey<?>> extra = [
|
Set<AttributeKey<?>> extra = [
|
||||||
|
@ -85,6 +91,7 @@ abstract class AbstractOkHttp3Test extends HttpClientTest<Request> {
|
||||||
switch (uri.toString()) {
|
switch (uri.toString()) {
|
||||||
case "http://localhost:61/":
|
case "http://localhost:61/":
|
||||||
case "https://192.0.2.1/":
|
case "https://192.0.2.1/":
|
||||||
|
case resolveAddress("/read-timeout").toString():
|
||||||
attributes.remove(SemanticAttributes.HTTP_FLAVOR)
|
attributes.remove(SemanticAttributes.HTTP_FLAVOR)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue