Skip to content

Commit 03d2e35

Browse files
committed
Add test to demonstrate problem
1 parent a80505d commit 03d2e35

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/redis_client/circuit_breaker_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ def test_open_circuit_after_consecutive_errors
2121
assert_open @circuit_breaker
2222
end
2323

24+
def test_track_errors_during_error_threshold_window
25+
assert_closed @circuit_breaker
26+
(@circuit_breaker.error_threshold - 1).times do
27+
record_error @circuit_breaker
28+
end
29+
30+
travel(@circuit_breaker.error_threshold_timeout - 0.01) do
31+
record_error @circuit_breaker
32+
assert_open @circuit_breaker
33+
end
34+
end
35+
2436
def test_allow_use_after_the_errors_timedout
2537
open_circuit @circuit_breaker
2638
assert_open @circuit_breaker

0 commit comments

Comments
 (0)