Remove HttpServerTest.testExceptionBody and redirectHasBody (#2346)
This commit is contained in:
parent
5d8c6c3e67
commit
1ca7276593
|
@ -8,11 +8,6 @@ import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
|||
|
||||
abstract class AkkaHttpServerInstrumentationTest extends HttpServerTest<Object> implements AgentTestTrait {
|
||||
|
||||
@Override
|
||||
boolean testExceptionBody() {
|
||||
false
|
||||
}
|
||||
|
||||
// FIXME: This doesn't work because we don't support bindAndHandle.
|
||||
// @Override
|
||||
// def startServer(int port) {
|
||||
|
|
|
@ -71,10 +71,6 @@ class DropwizardTest extends HttpServerTest<DropwizardTestSupport> implements Ag
|
|||
true
|
||||
}
|
||||
|
||||
boolean testExceptionBody() {
|
||||
false
|
||||
}
|
||||
|
||||
@Override
|
||||
void handlerSpan(TraceAssert trace, int index, Object parent, String method = "GET", ServerEndpoint endpoint = SUCCESS) {
|
||||
trace.span(index) {
|
||||
|
|
|
@ -106,9 +106,4 @@ class GrizzlyTest extends HttpServerTest<HttpServer> implements AgentTestTrait {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testExceptionBody() {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,11 +59,6 @@ class JettyHandlerTest extends HttpServerTest<Server> implements AgentTestTrait
|
|||
server.stop()
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testExceptionBody() {
|
||||
false
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasResponseSpan(ServerEndpoint endpoint) {
|
||||
endpoint == REDIRECT || endpoint == ERROR
|
||||
|
|
|
@ -65,11 +65,6 @@ class PlayServerTest extends HttpServerTest<Server> implements AgentTestTrait {
|
|||
true
|
||||
}
|
||||
|
||||
boolean testExceptionBody() {
|
||||
// I can't figure out how to set a proper exception handler to customize the response body.
|
||||
false
|
||||
}
|
||||
|
||||
@Override
|
||||
void handlerSpan(TraceAssert trace, int index, Object parent, String method = "GET", ServerEndpoint endpoint = SUCCESS) {
|
||||
trace.span(index) {
|
||||
|
|
|
@ -67,11 +67,6 @@ class PlayServerTest extends HttpServerTest<Server> implements AgentTestTrait {
|
|||
true
|
||||
}
|
||||
|
||||
boolean testExceptionBody() {
|
||||
// I can't figure out how to set a proper exception handler to customize the response body.
|
||||
false
|
||||
}
|
||||
|
||||
@Override
|
||||
void handlerSpan(TraceAssert trace, int index, Object parent, String method = "GET", ServerEndpoint endpoint = SUCCESS) {
|
||||
trace.span(index) {
|
||||
|
|
|
@ -65,11 +65,6 @@ class GlassFishServerTest extends HttpServerTest<GlassFish> implements AgentTest
|
|||
server.stop()
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean redirectHasBody() {
|
||||
true
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasResponseSpan(ServerEndpoint endpoint) {
|
||||
endpoint == REDIRECT || endpoint == ERROR || endpoint == NOT_FOUND
|
||||
|
|
|
@ -32,11 +32,6 @@ import spock.lang.Unroll
|
|||
@Unroll
|
||||
abstract class TomcatServlet3Test extends AbstractServlet3Test<Tomcat, Context> {
|
||||
|
||||
@Override
|
||||
boolean testExceptionBody() {
|
||||
return false
|
||||
}
|
||||
|
||||
@Override
|
||||
Class<?> expectedExceptionClass() {
|
||||
ServletException
|
||||
|
|
|
@ -72,11 +72,6 @@ class ServletFilterTest extends HttpServerTest<ConfigurableApplicationContext> i
|
|||
true
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testExceptionBody() {
|
||||
false
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testNotFound() {
|
||||
// FIXME: the instrumentation adds an extra controller span which is not consistent.
|
||||
|
|
|
@ -33,11 +33,6 @@ class Struts2ActionSpanTest extends HttpServerTest<Server> implements AgentTestT
|
|||
return true
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testExceptionBody() {
|
||||
return false
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testErrorBody() {
|
||||
return false
|
||||
|
|
|
@ -35,9 +35,6 @@ public class TestServlet extends HttpServlet {
|
|||
}
|
||||
return null;
|
||||
});
|
||||
} else if ("/errorPage".equals(path)) {
|
||||
resp.getWriter().print(HttpServerTest.ServerEndpoint.EXCEPTION.getBody());
|
||||
resp.setStatus(500);
|
||||
} else {
|
||||
resp.getWriter().println("No cookie for you: " + path);
|
||||
resp.setStatus(400);
|
||||
|
|
|
@ -5,19 +5,14 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.tomcat7
|
||||
|
||||
import static io.opentelemetry.api.trace.SpanKind.INTERNAL
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.ERROR
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.EXCEPTION
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS
|
||||
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.sdk.trace.data.SpanData
|
||||
import org.apache.catalina.Context
|
||||
import org.apache.catalina.startup.Tomcat
|
||||
import org.apache.tomcat.util.descriptor.web.ErrorPage
|
||||
|
||||
class TomcatHandlerTest extends HttpServerTest<Tomcat> implements AgentTestTrait {
|
||||
|
||||
|
@ -42,12 +37,6 @@ class TomcatHandlerTest extends HttpServerTest<Tomcat> implements AgentTestTrait
|
|||
|
||||
Tomcat.addServlet(ctx, "testServlet", new TestServlet())
|
||||
|
||||
def errorPage = new ErrorPage()
|
||||
errorPage.setLocation("/errorPage")
|
||||
errorPage.setErrorCode(500)
|
||||
ctx.addErrorPage(errorPage)
|
||||
ctx.addServletMappingDecoded("/errorPage", "testServlet")
|
||||
|
||||
// Mapping servlet to /* will result in all requests have a name of just a context.
|
||||
ServerEndpoint.values().each {
|
||||
ctx.addServletMappingDecoded(it.path, "testServlet")
|
||||
|
@ -62,28 +51,6 @@ class TomcatHandlerTest extends HttpServerTest<Tomcat> implements AgentTestTrait
|
|||
tomcat.getServer().stop()
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testExceptionBody() {
|
||||
false
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasErrorPageSpans(ServerEndpoint endpoint) {
|
||||
endpoint == ERROR || endpoint == EXCEPTION
|
||||
}
|
||||
|
||||
@Override
|
||||
void errorPageSpans(TraceAssert trace, int index, Object parent, String method = "GET", ServerEndpoint endpoint = SUCCESS) {
|
||||
trace.span(index) {
|
||||
name "ApplicationDispatcher.forward"
|
||||
kind INTERNAL
|
||||
errored false
|
||||
childOf((SpanData) parent)
|
||||
attributes {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasResponseSpan(ServerEndpoint endpoint) {
|
||||
endpoint == REDIRECT || endpoint == ERROR
|
||||
|
|
|
@ -66,9 +66,4 @@ class UndertowServerTest extends HttpServerTest<Undertow> implements AgentTestTr
|
|||
String expectedServerSpanName(ServerEndpoint endpoint) {
|
||||
return "PathHandler.handleRequest"
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testExceptionBody() {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,11 +53,6 @@ class VertxRxHttpServerTest extends HttpServerTest<Vertx> implements AgentTestTr
|
|||
server.close()
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testExceptionBody() {
|
||||
return false
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testException() {
|
||||
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/807
|
||||
|
|
|
@ -48,11 +48,6 @@ class VertxHttpServerTest extends HttpServerTest<Vertx> implements AgentTestTrai
|
|||
server.close()
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testExceptionBody() {
|
||||
return false
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testException() {
|
||||
// TODO(anuraaga): https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/807
|
||||
|
|
|
@ -67,10 +67,6 @@ abstract class HttpServerTest<SERVER> extends InstrumentationSpecification imple
|
|||
false
|
||||
}
|
||||
|
||||
boolean redirectHasBody() {
|
||||
false
|
||||
}
|
||||
|
||||
boolean testNotFound() {
|
||||
true
|
||||
}
|
||||
|
@ -83,10 +79,6 @@ abstract class HttpServerTest<SERVER> extends InstrumentationSpecification imple
|
|||
true
|
||||
}
|
||||
|
||||
boolean testExceptionBody() {
|
||||
true
|
||||
}
|
||||
|
||||
boolean testException() {
|
||||
true
|
||||
}
|
||||
|
@ -261,7 +253,6 @@ abstract class HttpServerTest<SERVER> extends InstrumentationSpecification imple
|
|||
response.code() == REDIRECT.status
|
||||
response.header("location") == REDIRECT.body ||
|
||||
response.header("location") == "${address.resolve(REDIRECT.body)}"
|
||||
response.body().contentLength() < 1 || redirectHasBody()
|
||||
|
||||
and:
|
||||
assertTheTraces(1, null, null, method, REDIRECT, null, response)
|
||||
|
@ -299,9 +290,6 @@ abstract class HttpServerTest<SERVER> extends InstrumentationSpecification imple
|
|||
|
||||
expect:
|
||||
response.code() == EXCEPTION.status
|
||||
if (testExceptionBody()) {
|
||||
assert response.body().string() == EXCEPTION.body
|
||||
}
|
||||
|
||||
and:
|
||||
assertTheTraces(1, null, null, method, EXCEPTION, EXCEPTION.body, response)
|
||||
|
|
Loading…
Reference in New Issue