Harmonize Solr status health details
This commit renames the `solrStatus` property of the Solr health indicator to `status` and its type. This is now an integer corresponding to the status Solr sent rather than a String that can be "OK" when all is well. Closes gh-8878
This commit is contained in:
@@ -43,8 +43,7 @@ public class SolrHealthIndicator extends AbstractHealthIndicator {
|
||||
CoreAdminResponse response = request.process(this.solrClient);
|
||||
int statusCode = response.getStatus();
|
||||
Status status = (statusCode == 0 ? Status.UP : Status.DOWN);
|
||||
builder.status(status).withDetail("solrStatus",
|
||||
(statusCode == 0 ? "OK" : statusCode));
|
||||
builder.status(status).withDetail("status", statusCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class SolrHealthIndicatorTests {
|
||||
SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient);
|
||||
Health health = healthIndicator.health();
|
||||
assertThat(health.getStatus()).isEqualTo(Status.UP);
|
||||
assertThat(health.getDetails().get("solrStatus")).isEqualTo("OK");
|
||||
assertThat(health.getDetails().get("status")).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -83,7 +83,7 @@ public class SolrHealthIndicatorTests {
|
||||
SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient);
|
||||
Health health = healthIndicator.health();
|
||||
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
|
||||
assertThat(health.getDetails().get("solrStatus")).isEqualTo(400);
|
||||
assertThat(health.getDetails().get("status")).isEqualTo(400);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user