Search in sources :

Example 1 with InfluxDBException

use of org.influxdb.InfluxDBException in project spring-boot by spring-projects.

the class InfluxDbHealthIndicatorTests method influxDbIsDown.

@Test
void influxDbIsDown() {
    InfluxDB influxDb = mock(InfluxDB.class);
    given(influxDb.ping()).willThrow(new InfluxDBException(new IOException("Connection failed")));
    InfluxDbHealthIndicator healthIndicator = new InfluxDbHealthIndicator(influxDb);
    Health health = healthIndicator.health();
    assertThat(health.getStatus()).isEqualTo(Status.DOWN);
    assertThat((String) health.getDetails().get("error")).contains("Connection failed");
    then(influxDb).should().ping();
}
Also used : InfluxDBException(org.influxdb.InfluxDBException) Health(org.springframework.boot.actuate.health.Health) InfluxDB(org.influxdb.InfluxDB) IOException(java.io.IOException) Test(org.junit.jupiter.api.Test)

Aggregations

IOException (java.io.IOException)1 InfluxDB (org.influxdb.InfluxDB)1 InfluxDBException (org.influxdb.InfluxDBException)1 Test (org.junit.jupiter.api.Test)1 Health (org.springframework.boot.actuate.health.Health)1