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
pull/5662/merge
Stephane Nicoll 8 years ago
parent 23360d11a2
commit b9d1f5e097

@ -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

Loading…
Cancel
Save