use of com.hotels.styx.client.healthcheck.OriginHealthCheckFunction.OriginState.UNHEALTHY in project styx by ExpediaGroup.
the class UrlRequestHealthCheckTest method declaredOriginUnhealthyOnTransportException.
@Test
public void declaredOriginUnhealthyOnTransportException() {
HttpClient client = request -> respondWith(new RuntimeException("health check failure, as expected"));
new UrlRequestHealthCheck("/version.txt", metrics).check(client, someOrigin, state -> this.originState = state);
assertThat(originState, is(UNHEALTHY));
assertThat(metrics.getRegistry().find("proxy.client.originHealthCheckFailures").tags("originId", someOrigin.id().toString(), "appId", someOrigin.applicationId().toString()).counter().count(), is(1.0));
assertThat(meters(id -> id.getName().equals("proxy.client.originHealthCheckFailures")).size(), is(1));
}
use of com.hotels.styx.client.healthcheck.OriginHealthCheckFunction.OriginState.UNHEALTHY in project styx by ExpediaGroup.
the class UrlRequestHealthCheckTest method declaresOriginUnhealthyOnNon200Ok.
@Test
public void declaresOriginUnhealthyOnNon200Ok() {
HttpClient client = request -> respondWith(NOT_FOUND);
new UrlRequestHealthCheck("/version.txt", metrics).check(client, someOrigin, state -> this.originState = state);
assertThat(originState, is(UNHEALTHY));
assertThat(metrics.getRegistry().find("proxy.client.originHealthCheckFailures").tags("originId", someOrigin.id().toString(), "appId", someOrigin.applicationId().toString()).counter().count(), is(1.0));
assertThat(meters(id -> id.getName().equals("proxy.client.originHealthCheckFailures")).size(), is(1));
}
Aggregations