File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,21 @@ class PolicySpec extends FunSpec with BeforeAndAfterAll {
116
116
assert(took <= 110 .millis === true ,
117
117
s " took more time than expected: $took" )
118
118
}
119
+
120
+ it (" should wait up to a max time each time" ) {
121
+ implicit val success = Success [Int ](_ == 2 )
122
+ val tries = forwardCountingFutureStream().iterator
123
+ val policy = retry.Backoff (2 , 30 .millis, maxDelay = 50 .millis)
124
+ val took = time {
125
+ val result = Await .result(policy(tries.next),
126
+ 80 .millis + 20 .millis)
127
+ assert(success.predicate(result) === true , " predicate failed" )
128
+ }
129
+ assert(took >= 80 .millis === true ,
130
+ s " took less time than expected: $took" )
131
+ assert(took <= 100 .millis === true ,
132
+ s " took more time than expected: $took" )
133
+ }
119
134
}
120
135
121
136
describe(" retry.When" ) {
You can’t perform that action at this time.
0 commit comments