Skip to content

Commit 2160fd8

Browse files
committed
Add connection failure test
1 parent 3f828df commit 2160fd8

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

dd-java-agent/instrumentation/reactor-netty-1.0/src/test/groovy/ReactorNettyHttpClientTest.groovy

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import datadog.environment.JavaVirtualMachine
22
import datadog.trace.agent.test.base.HttpClientTest
3+
import datadog.trace.agent.test.utils.PortUtils
34
import datadog.trace.agent.test.naming.TestingNettyHttpNamingConventions
45
import datadog.trace.instrumentation.netty41.client.NettyHttpClientDecorator
56
import io.netty.handler.codec.http.HttpMethod
@@ -70,6 +71,40 @@ class ReactorNettyHttpClientTest extends HttpClientTest implements TestingNettyH
7071
false
7172
}
7273

74+
def "connection error produces netty.connect error span"() {
75+
given:
76+
def uri = new URI("http://localhost:${PortUtils.UNUSABLE_PORT}/")
77+
78+
when:
79+
runUnderTrace("parent") {
80+
httpClient.get()
81+
.uri(uri)
82+
.responseSingle({ r, b -> b.asString() })
83+
.block()
84+
}
85+
86+
then:
87+
def ex = thrown(Exception)
88+
assertTraces(1) {
89+
trace(2) {
90+
basicSpan(it, "parent", null, ex)
91+
span {
92+
operationName "netty.connect"
93+
resourceName "netty.connect"
94+
childOf span(0)
95+
errored true
96+
tags {
97+
"component" "netty"
98+
"error.type" String
99+
"error.message" String
100+
"error.stack" String
101+
defaultTags()
102+
}
103+
}
104+
}
105+
}
106+
}
107+
73108
@Override
74109
boolean testRemoteConnection() {
75110
return false

0 commit comments

Comments
 (0)