Fixed test issues (#62)

This commit is contained in:
Pontus Rydin 2020-01-15 23:17:30 -05:00 committed by Trask Stalnaker
parent 80d36902a0
commit 686f72e02f
3 changed files with 8 additions and 7 deletions

View File

@ -18,8 +18,6 @@ class CassandraClientTest extends AgentTestRunner {
@Shared
Cluster cluster
@Shared
int port = 9142
def setupSpec() {
/*
@ -28,7 +26,7 @@ class CassandraClientTest extends AgentTestRunner {
started in container like we do for memcached. Note: this will complicate things because
tests would have to assume they run under shared Cassandra and act accordingly.
*/
EmbeddedCassandraServerHelper.startEmbeddedCassandra(120000L)
EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.CASSANDRA_RNDPORT_YML_FILE, 120000L)
cluster = EmbeddedCassandraServerHelper.getCluster()
@ -124,7 +122,7 @@ class CassandraClientTest extends AgentTestRunner {
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
"$Tags.PEER_HOSTNAME" "localhost"
"$Tags.PEER_HOST_IPV4" "127.0.0.1"
"$Tags.PEER_PORT" port
"$Tags.PEER_PORT" EmbeddedCassandraServerHelper.getNativeTransportPort()
"$Tags.DB_TYPE" "cassandra"
"$Tags.DB_INSTANCE" keyspace
"$Tags.DB_STATEMENT" statement

View File

@ -11,6 +11,7 @@ import io.opentelemetry.auto.instrumentation.jaxrs2.JaxRsAnnotationsDecorator
import io.opentelemetry.auto.instrumentation.servlet3.Servlet3Decorator
import io.opentelemetry.auto.test.asserts.TraceAssert
import io.opentelemetry.auto.test.base.HttpServerTest
import io.opentelemetry.auto.test.utils.PortUtils
import io.opentelemetry.sdk.trace.SpanData
import org.eclipse.jetty.servlet.ServletHandler
@ -29,9 +30,11 @@ class DropwizardTest extends HttpServerTest<DropwizardTestSupport, Servlet3Decor
@Override
DropwizardTestSupport startServer(int port) {
println "Port: $port"
def testSupport = new DropwizardTestSupport(testApp(),
null,
ConfigOverride.config("server.applicationConnectors[0].port", "$port"))
ConfigOverride.config("server.applicationConnectors[0].port", "$port"),
ConfigOverride.config("server.adminConnectors[0].port", PortUtils.randomOpenPort().toString()))
testSupport.before()
return testSupport
}

View File

@ -61,7 +61,7 @@ class Netty40ClientTest extends HttpClientTest<NettyHttpClientDecorator> {
def "connection error (unopened port)"() {
given:
def uri = new URI("http://localhost:$UNUSABLE_PORT/")
def uri = new URI("http://127.0.0.1:$UNUSABLE_PORT/") // Use numeric address to avoid ipv4/ipv6 confusion
when:
runUnderTrace("parent") {
@ -93,7 +93,7 @@ class Netty40ClientTest extends HttpClientTest<NettyHttpClientDecorator> {
} 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:$UNUSABLE_PORT"
errorTags errorClass, "Connection refused: /127.0.0.1:$UNUSABLE_PORT"
}
}
}