This is an automated email from the ASF dual-hosted git repository.
Philippus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/main by this push:
new b3f5bf90cc Check if expected messages are produced (#3351)
b3f5bf90cc is described below
commit b3f5bf90cc8ab7416208dd582900368f0fa9dc20
Author: Philippus Baalman <[email protected]>
AuthorDate: Tue Jul 14 16:23:36 2026 +0200
Check if expected messages are produced (#3351)
---
.../org/apache/pekko/stream/scaladsl/FlowLimitSpec.scala | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git
a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowLimitSpec.scala
b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowLimitSpec.scala
index 71e10c62c4..0c5e4c3c1b 100644
---
a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowLimitSpec.scala
+++
b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowLimitSpec.scala
@@ -17,6 +17,7 @@ import scala.concurrent.Await
import org.apache.pekko
import pekko.stream.StreamLimitReachedException
+import pekko.stream.testkit.scaladsl.TestSink
import pekko.stream.testkit.StreamSpec
class FlowLimitSpec extends StreamSpec("""
@@ -49,15 +50,15 @@ class FlowLimitSpec extends StreamSpec("""
}
"produce n messages before throwing a StreamLimitReachedException when n <
input.size" in {
- // TODO: check if it actually produces n messages
val input = 1 to 6
val n = input.length - 2 // n < input.length
- val future =
Source(input).limit(n).grouped(Integer.MAX_VALUE).runWith(Sink.head)
+ val probe = Source(input).limit(n).runWith(TestSink[Int]())
- a[StreamLimitReachedException] shouldBe thrownBy {
- Await.result(future, remainingOrDefault)
- }
+ probe
+ .request(n + 1)
+ .expectNextN(input.take(n))
+ probe.expectError() shouldBe a[StreamLimitReachedException]
}
"throw a StreamLimitReachedException when n < 0" in {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]