Update gateway actuator metrics test to use @ClassPathExclusions to verify gateway doesn't fall over when actuator metrics are not added as project dependency

This commit is contained in:
Tony Clarke
2018-07-28 21:46:36 -04:00
parent 0b8a84e1b7
commit b0bc375fb2
4 changed files with 119 additions and 6 deletions

View File

@@ -45,6 +45,7 @@ import org.springframework.web.reactive.function.server.ServerResponse;
@Import(AdditionalRoutes.class)
public class GatewaySampleApplication {
public static final String HELLO_FROM_FAKE_ACTUATOR_METRICS_GATEWAY_REQUESTS = "hello from fake /actuator/metrics/gateway.requests";
@Value("${test.uri:http://httpbin.org:80}")
String uri;
@@ -135,6 +136,14 @@ public class GatewaySampleApplication {
return route;
}
@Bean
public RouterFunction<ServerResponse> testWhenMetricPathIsNotMeet() {
RouterFunction<ServerResponse> route = RouterFunctions.route(
RequestPredicates.path("/actuator/metrics/gateway.requests"),
request -> ServerResponse.ok().body(BodyInserters.fromObject(HELLO_FROM_FAKE_ACTUATOR_METRICS_GATEWAY_REQUESTS)));
return route;
}
static class Hello {
String message;