He-Pin commented on code in PR #2631:
URL: https://github.com/apache/pekko/pull/2631#discussion_r2703093901
##########
stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SourceSpec.scala:
##########
@@ -715,33 +715,30 @@ class SourceSpec extends StreamSpec with DefaultTimeout {
assert(counter.get() == 3)
}
- "not retry FailedSources" in {
- // https://github.com/apache/pekko/issues/2620
+ "should retry on a failed source" in {
val counter = new java.util.concurrent.atomic.AtomicInteger()
val source =
- withRetriesTest(failedSource("origin")) { _ =>
- counter.incrementAndGet()
- failedSource("does not work")
- } { _ =>
- counter.get() < 3
- }
+ withRetriesTest(failedSource("origin")) { () =>
+ if (counter.incrementAndGet() < 3) {
+ failedSource("does not work")
+ } else Source.single(ByteString.fromString("ok"))
+ } { _ => true }
+ .runWith(Sink.head)
+ val result = Await.result(source, Duration.Inf)
+ assert(result.utf8String == "ok")
- assertThrows[ArithmeticException] {
- Await.result(source.runWith(Sink.ignore), Duration.Inf)
- }
-
- assert(counter.get() == 1)
+ assert(counter.get() == 3)
Review Comment:
Updated this with fix
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]