Add validation query to DataSourceHealthIndicator details
See gh-15055
This commit is contained in:
parent
bbad720e23
commit
fc85c34dd8
|
@ -115,6 +115,7 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator
|
|||
new SingleColumnRowMapper());
|
||||
Object result = DataAccessUtils.requiredSingleResult(results);
|
||||
builder.withDetail("result", result);
|
||||
builder.withDetail("validationQuery", validationQuery);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ public class DataSourceHealthIndicatorTests {
|
|||
assertThat(health.getDetails().get("database")).isNotNull();
|
||||
assertThat(health.getStatus()).isEqualTo(Status.UP);
|
||||
assertThat(health.getDetails().get("result")).isNotNull();
|
||||
assertThat(health.getDetails().get("validationQuery"))
|
||||
.isEqualTo("SELECT COUNT(*) from FOO");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue