From 81d62083f58ca6239eef4bcdf7c695198b26f3ee Mon Sep 17 00:00:00 2001 From: Robert Winkler Date: Thu, 15 Mar 2018 10:35:52 +0100 Subject: [PATCH] Issue #212: Added test to FluxCircuitBreakerTest to verify that a CircuitBreakerException is thrown when you subscribe to Flux.error. --- README.adoc | 3 +++ .../operator/FluxCircuitBreakerTest.java | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/README.adoc b/README.adoc index 97e3153af0..fddb767e28 100644 --- a/README.adoc +++ b/README.adoc @@ -28,6 +28,9 @@ Core modules: Add-on modules +* resilience4j-reactor: Spring Reactor adapter +* resilience4j-rxjava2: RxJava2 adapter +* resilience4j-micrometer: Micrometer Metrics exporter * resilience4j-metrics: Dropwizard Metrics exporter * resilience4j-prometheus: Prometheus Metrics exporter * resilience4j-spring-boot: Spring Boot Starter diff --git a/resilience4j-reactor/src/test/java/io/github/resilience4j/reactor/circuitbreaker/operator/FluxCircuitBreakerTest.java b/resilience4j-reactor/src/test/java/io/github/resilience4j/reactor/circuitbreaker/operator/FluxCircuitBreakerTest.java index bf110d7906..3fe641a7df 100644 --- a/resilience4j-reactor/src/test/java/io/github/resilience4j/reactor/circuitbreaker/operator/FluxCircuitBreakerTest.java +++ b/resilience4j-reactor/src/test/java/io/github/resilience4j/reactor/circuitbreaker/operator/FluxCircuitBreakerTest.java @@ -60,6 +60,18 @@ public void shouldEmitErrorWithCircuitBreakerOpenException() { assertNoRegisteredCall(); } + @Test + public void shouldEmitCircuitBreakerOpenExceptionEvenWhenErrorNotOnSubscribe() { + circuitBreaker.transitionToOpenState(); + StepVerifier.create( + Flux.error(new IOException("BAM!"), true) + .transform(CircuitBreakerOperator.of(circuitBreaker))) + .expectError(CircuitBreakerOpenException.class) + .verify(Duration.ofSeconds(1)); + + assertNoRegisteredCall(); + } + @Test public void shouldEmitCircuitBreakerOpenExceptionEvenWhenErrorDuringSubscribe() { circuitBreaker.transitionToOpenState();