Merge pull request #692 from DataDog/mar-kolya/netty-4.0-improve-test

Make test results in netty-4.0 client tests more readable
This commit is contained in:
Nikolay Martynov 2019-02-05 09:35:55 -05:00 committed by GitHub
commit f3d3d1269a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()
}
}