Skip to content

Commit

Permalink
Test v3 actuator API with loggers endpoint
Browse files Browse the repository at this point in the history
Update `LoggersEndpointWebIntegrationTests` to ensure that the new
v3 media type can be used.

See gh-17929
  • Loading branch information
philwebb committed Sep 26, 2019
1 parent deb9d67 commit cd1b7c1
Showing 1 changed file with 13 additions and 4 deletions.
Expand Up @@ -132,6 +132,15 @@ void setLoggerUsingActuatorV2JsonShouldSetLogLevel() {
verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG);
}

@WebEndpointTest
void setLoggerUsingActuatorV3JsonShouldSetLogLevel() {
this.client.post().uri("/actuator/loggers/ROOT")
.contentType(MediaType.parseMediaType(ActuatorMediaType.V3_JSON))
.bodyValue(Collections.singletonMap("configuredLevel", "debug")).exchange().expectStatus()
.isNoContent();
verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG);
}

@WebEndpointTest
void setLoggerGroupUsingActuatorV2JsonShouldSetLogLevel() {
this.client.post().uri("/actuator/loggers/test")
Expand Down Expand Up @@ -162,23 +171,23 @@ void setLoggerOrLoggerGroupWithWrongLogLevelResultInBadRequestResponse() {
@WebEndpointTest
void setLoggerWithNullLogLevel() {
this.client.post().uri("/actuator/loggers/ROOT")
.contentType(MediaType.parseMediaType(ActuatorMediaType.V2_JSON))
.contentType(MediaType.parseMediaType(ActuatorMediaType.V3_JSON))
.bodyValue(Collections.singletonMap("configuredLevel", null)).exchange().expectStatus().isNoContent();
verify(this.loggingSystem).setLogLevel("ROOT", null);
}

@WebEndpointTest
void setLoggerWithNoLogLevel() {
this.client.post().uri("/actuator/loggers/ROOT")
.contentType(MediaType.parseMediaType(ActuatorMediaType.V2_JSON)).bodyValue(Collections.emptyMap())
.contentType(MediaType.parseMediaType(ActuatorMediaType.V3_JSON)).bodyValue(Collections.emptyMap())
.exchange().expectStatus().isNoContent();
verify(this.loggingSystem).setLogLevel("ROOT", null);
}

@WebEndpointTest
void setLoggerGroupWithNullLogLevel() {
this.client.post().uri("/actuator/loggers/test")
.contentType(MediaType.parseMediaType(ActuatorMediaType.V2_JSON))
.contentType(MediaType.parseMediaType(ActuatorMediaType.V3_JSON))
.bodyValue(Collections.singletonMap("configuredLevel", null)).exchange().expectStatus().isNoContent();
verify(this.loggingSystem).setLogLevel("test.member1", null);
verify(this.loggingSystem).setLogLevel("test.member2", null);
Expand All @@ -187,7 +196,7 @@ void setLoggerGroupWithNullLogLevel() {
@WebEndpointTest
void setLoggerGroupWithNoLogLevel() {
this.client.post().uri("/actuator/loggers/test")
.contentType(MediaType.parseMediaType(ActuatorMediaType.V2_JSON)).bodyValue(Collections.emptyMap())
.contentType(MediaType.parseMediaType(ActuatorMediaType.V3_JSON)).bodyValue(Collections.emptyMap())
.exchange().expectStatus().isNoContent();
verify(this.loggingSystem).setLogLevel("test.member1", null);
verify(this.loggingSystem).setLogLevel("test.member2", null);
Expand Down

0 comments on commit cd1b7c1

Please sign in to comment.