Make test results in netty-4.0 client tests more readable
@@ -2,7 +2,6 @@ import datadog.trace.agent.test.AgentTestRunner
import datadog.trace.agent.test.TestUtils
import datadog.trace.api.DDSpanTypes
import datadog.trace.api.DDTags
-import io.netty.channel.AbstractChannel
import io.opentracing.tag.Tags
import org.asynchttpclient.AsyncHttpClient
import org.asynchttpclient.DefaultAsyncHttpClientConfig
@@ -106,11 +105,13 @@ class Netty40ClientTest extends AgentTestRunner {
errored true
tags {
"$Tags.COMPONENT.key" "netty"
+ Class errorClass = ConnectException
try {
- errorTags ConnectException, "Connection refused: localhost/127.0.0.1:$invalidPort"
- } catch (AssertionError e) {
- errorTags AbstractChannel.AnnotatedConnectException, "Connection refused: localhost/127.0.0.1:$invalidPort"
+ errorClass = Class.forName('io.netty.channel.AbstractChannel$AnnotatedConnectException')
+ } catch (ClassNotFoundException e) {
+ // Older versions use 'java.net.ConnectException' and do not have 'io.netty.channel.AbstractChannel$AnnotatedConnectException'
}
+ errorTags errorClass, "Connection refused: localhost/127.0.0.1:$invalidPort"
defaultTags()
}
}
