pjfanning commented on code in PR #582:
URL: https://github.com/apache/incubator-pekko/pull/582#discussion_r1301073530
##########
stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SourceSpec.scala:
##########
@@ -311,19 +311,60 @@ class SourceSpec extends StreamSpec with DefaultTimeout {
}
"use decider when iterator throws" in {
+
+ Source
+ .fromIterator(() => (1 to 5).toIterator.map(k => if (k != 3) k else
throw TE("a")))
+
.withAttributes(ActorAttributes.supervisionStrategy(Supervision.stoppingDecider))
+ .grouped(10)
+ .runWith(Sink.head)
+ .failed
+ .futureValue shouldBe an[TE]
+
+ Source
+ .fromIterator(() => (1 to 5).toIterator.map(k => if (k != 3) k else
throw TE("a")))
+
.withAttributes(ActorAttributes.supervisionStrategy(Supervision.stoppingDecider))
+ .recoverWithRetries(1, { case _ => Source.empty })
+ .grouped(10)
+ .runWith(Sink.head)
+ .futureValue shouldBe List(1, 2)
+
+ Source
+ .fromIterator(() => (1 to 5).toIterator.map(k => if (k != 3) k else
throw TE("a")))
+
.withAttributes(ActorAttributes.supervisionStrategy(Supervision.resumingDecider))
+ .grouped(10)
+ .runWith(Sink.head)
+ .futureValue should ===(List(1, 2, 4, 5))
+
Source
.fromIterator(() => (1 to 5).toIterator.map(k => if (k != 3) k else
throw TE("a")))
.withAttributes(ActorAttributes.supervisionStrategy(Supervision.restartingDecider))
.grouped(10)
.runWith(Sink.head)
- .futureValue should ===(List(1, 2))
+ .futureValue should ===(List(1, 2, 1, 2, 1, 2, 1, 2, 1, 2))
Source
.fromIterator(() => (1 to 5).toIterator.map(_ => throw TE("b")))
.withAttributes(ActorAttributes.supervisionStrategy(Supervision.restartingDecider))
.grouped(10)
.runWith(Sink.headOption)
- .futureValue should ===(None)
+ .failed
+ .futureValue shouldBe an[TE]
Review Comment:
`shouldBe a[TE]` would be better
--
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]