Make test results in netty-4.0 client tests more readable

This commit is contained in:
Nikolay Martynov 2019-02-04 15:39:42 -05:00
parent 9353f82063
commit b25784e7a2
1 changed files with 5 additions and 4 deletions

View File

@ -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()
}
}