use of com.hotels.styx.api.plugins.spi.Plugin.PASS_THROUGH in project styx by ExpediaGroup.
the class InstrumentedPluginTest method metricIsNotRecordedWhenErrorStatusIsReturnedByChain.
@Test
public void metricIsNotRecordedWhenErrorStatusIsReturnedByChain() {
Chain chain = request -> aResponse(INTERNAL_SERVER_ERROR);
String pluginName = "doNotRecordMe";
InstrumentedPlugin plugin = instrumentedPlugin(pluginName, PASS_THROUGH);
LiveHttpResponse response = Mono.from(plugin.intercept(someRequest, chain)).block();
assertThat(response.status(), is(INTERNAL_SERVER_ERROR));
assertThat(getStatusCount(pluginName, "500"), is(0.0));
assertThat(getErrorCount(pluginName), is(0.0));
}
use of com.hotels.styx.api.plugins.spi.Plugin.PASS_THROUGH in project styx by ExpediaGroup.
the class InstrumentedPluginTest method metricsAreNotRecordedWhenExceptionIsReturnedByChain.
@Test
public void metricsAreNotRecordedWhenExceptionIsReturnedByChain() {
String pluginName = "passThrough";
Chain chain = request -> error(new SomeException());
InstrumentedPlugin plugin = instrumentedPlugin(pluginName, PASS_THROUGH);
assertThatEventualHasErrorOnly(SomeException.class, plugin.intercept(someRequest, chain));
assertThat(getExceptionCount(pluginName, SOME_EXCEPTION), is(0.0));
assertThat(getErrorCount(pluginName), is(0.0));
}
Aggregations