Fix grails latestDep test failure (#2547)
* Fix grails3 latestDep test failure * not found uses sendError
This commit is contained in:
parent
f94fabe07f
commit
569b7b5818
|
@ -31,8 +31,8 @@ dependencies {
|
||||||
testInstrumentation project(':instrumentation:tomcat-7.0:javaagent')
|
testInstrumentation project(':instrumentation:tomcat-7.0:javaagent')
|
||||||
testInstrumentation project(':instrumentation:spring:spring-webmvc-3.1:javaagent')
|
testInstrumentation project(':instrumentation:spring:spring-webmvc-3.1:javaagent')
|
||||||
|
|
||||||
testImplementation "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
|
testLibrary "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
|
||||||
testImplementation "org.springframework.boot:spring-boot-starter-tomcat:$springBootVersion"
|
testLibrary "org.springframework.boot:spring-boot-starter-tomcat:$springBootVersion"
|
||||||
|
|
||||||
testImplementation(project(':testing-common')) {
|
testImplementation(project(':testing-common')) {
|
||||||
exclude group: 'org.eclipse.jetty', module: 'jetty-server'
|
exclude group: 'org.eclipse.jetty', module: 'jetty-server'
|
||||||
|
|
|
@ -14,4 +14,9 @@ class ErrorController implements Controller {
|
||||||
def index() {
|
def index() {
|
||||||
render "Error"
|
render "Error"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Action
|
||||||
|
def notFound() {
|
||||||
|
response.sendError(404, "Not Found")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ class GrailsTest extends HttpServerTest<ConfigurableApplicationContext> implemen
|
||||||
} else if (endpoint == ERROR || endpoint == EXCEPTION) {
|
} else if (endpoint == ERROR || endpoint == EXCEPTION) {
|
||||||
return getContextPath() + "/error/index"
|
return getContextPath() + "/error/index"
|
||||||
} else if (endpoint == NOT_FOUND) {
|
} else if (endpoint == NOT_FOUND) {
|
||||||
return getContextPath() + "/error"
|
return getContextPath() + "/**"
|
||||||
}
|
}
|
||||||
return getContextPath() + "/test" + endpoint.path
|
return getContextPath() + "/test" + endpoint.path
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ class GrailsTest extends HttpServerTest<ConfigurableApplicationContext> implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
int getErrorPageSpansCount(ServerEndpoint endpoint) {
|
int getErrorPageSpansCount(ServerEndpoint endpoint) {
|
||||||
2
|
endpoint == NOT_FOUND ? 3 : 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -112,7 +112,7 @@ class GrailsTest extends HttpServerTest<ConfigurableApplicationContext> implemen
|
||||||
@Override
|
@Override
|
||||||
void errorPageSpans(TraceAssert trace, int index, Object parent, String method = "GET", ServerEndpoint endpoint) {
|
void errorPageSpans(TraceAssert trace, int index, Object parent, String method = "GET", ServerEndpoint endpoint) {
|
||||||
forwardSpan(trace, index, trace.span(0))
|
forwardSpan(trace, index, trace.span(0))
|
||||||
def errorSpanName = endpoint == NOT_FOUND ? "BasicErrorController.error" : "ErrorController.index"
|
def errorSpanName = endpoint == NOT_FOUND ? "ErrorController.notFound" : "ErrorController.index"
|
||||||
trace.span(index + 1) {
|
trace.span(index + 1) {
|
||||||
name errorSpanName
|
name errorSpanName
|
||||||
kind INTERNAL
|
kind INTERNAL
|
||||||
|
@ -120,6 +120,15 @@ class GrailsTest extends HttpServerTest<ConfigurableApplicationContext> implemen
|
||||||
attributes {
|
attributes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (endpoint == NOT_FOUND) {
|
||||||
|
trace.span(index + 2) {
|
||||||
|
name ~/\.sendError$/
|
||||||
|
kind INTERNAL
|
||||||
|
errored false
|
||||||
|
attributes {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -16,5 +16,6 @@ class UrlMappings {
|
||||||
"/path/$id/param"(controller: 'test', action: 'path')
|
"/path/$id/param"(controller: 'test', action: 'path')
|
||||||
|
|
||||||
"500"(controller: 'error')
|
"500"(controller: 'error')
|
||||||
|
"404"(controller: 'error', action: 'notFound')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue