use of org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest in project spring-boot by spring-projects.
the class EnvironmentEndpointWebIntegrationTests method nestedPathWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty.
@WebEndpointTest
void nestedPathWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty() {
Map<String, Object> map = new HashMap<>();
map.put("my.foo", "${my.bar}");
this.context.getEnvironment().getPropertySources().addFirst(new MapPropertySource("unresolved-placeholder", map));
this.client.get().uri("/actuator/env/my.foo").exchange().expectStatus().isOk().expectBody().jsonPath("property.value").isEqualTo("${my.bar}").jsonPath(forPropertyEntry("unresolved-placeholder")).isEqualTo("${my.bar}");
}
use of org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest in project spring-boot by spring-projects.
the class EnvironmentEndpointWebIntegrationTests method nestedPathMatchedByRegexWithSensitivePlaceholderShouldSanitize.
@WebEndpointTest
void nestedPathMatchedByRegexWithSensitivePlaceholderShouldSanitize() {
Map<String, Object> map = new HashMap<>();
map.put("my.foo", "${my.password}");
map.put("my.password", "hello");
this.context.getEnvironment().getPropertySources().addFirst(new MapPropertySource("placeholder", map));
this.client.get().uri("/actuator/env?pattern=my.*").exchange().expectStatus().isOk().expectBody().jsonPath(forProperty("placeholder", "my.foo")).isEqualTo("******");
}
use of org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest in project spring-boot by spring-projects.
the class EnvironmentEndpointWebIntegrationTests method regex.
@WebEndpointTest
void regex() {
Map<String, Object> map = new HashMap<>();
map.put("food", null);
this.context.getEnvironment().getPropertySources().addFirst(new MapPropertySource("null-value", map));
this.client.get().uri("/actuator/env?pattern=foo.*").exchange().expectStatus().isOk().expectBody().jsonPath(forProperty("test", "foo")).isEqualTo("bar").jsonPath(forProperty("test", "fool")).isEqualTo("baz");
}
use of org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest in project spring-boot by spring-projects.
the class PrometheusScrapeEndpointIntegrationTests method scrapeCanProduceOpenMetrics100.
@WebEndpointTest
void scrapeCanProduceOpenMetrics100(WebTestClient client) {
MediaType openMetrics = MediaType.parseMediaType(TextFormat.CONTENT_TYPE_OPENMETRICS_100);
client.get().uri("/actuator/prometheus").accept(openMetrics).exchange().expectStatus().isOk().expectHeader().contentType(openMetrics).expectBody(String.class).value((body) -> assertThat(body).contains("counter1_total").contains("counter2_total").contains("counter3_total"));
}
use of org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest in project spring-boot by spring-projects.
the class CachesEndpointWebIntegrationTests method clearNamedCache.
@WebEndpointTest
void clearNamedCache(WebTestClient client, ApplicationContext context) {
Cache b = context.getBean("one", CacheManager.class).getCache("b");
b.put("test", "value");
client.delete().uri("/actuator/caches/b").exchange().expectStatus().isNoContent();
assertThat(b.get("test")).isNull();
}
Aggregations