Skip to content

Commit 247cda6

Browse files
committed
chore: Test more rounds for unsafeDataVia keeping order.
1 parent b48cb05 commit 247cda6

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowWithContextSpec.scala

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,19 @@ class FlowWithContextSpec extends StreamSpec {
194194
.asFlowWithContext[Option[String], Int, Int](collapseContext = Tuple2.apply)(extractContext = _._2)
195195
.map(_._1)
196196

197-
SourceWithContext
198-
.fromTuples(Source(data)).via(
199-
FlowWithContext.unsafeOptionalDataVia(
200-
flow,
201-
Flow.fromFunction { (string: String) => string.toInt }
202-
)(Keep.none)
203-
)
204-
.runWith(TestSink.probe[(Option[Int], Int)])
205-
.request(4)
206-
.expectNext((Some(1), 1), (None, 2), (None, 3), (Some(4), 4))
207-
.expectComplete()
197+
for (_ <- 0 until 64) {
198+
SourceWithContext
199+
.fromTuples(Source(data)).via(
200+
FlowWithContext.unsafeOptionalDataVia(
201+
flow,
202+
Flow.fromFunction { (string: String) => string.toInt }
203+
)(Keep.none)
204+
)
205+
.runWith(TestSink.probe[(Option[Int], Int)])
206+
.request(4)
207+
.expectNext((Some(1), 1), (None, 2), (None, 3), (Some(4), 4))
208+
.expectComplete()
209+
}
208210
}
209211
}
210212
}

stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SourceWithContextSpec.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,16 @@ class SourceWithContextSpec extends StreamSpec {
242242

243243
val source = SourceWithContext.fromTuples(Source(data))
244244

245-
SourceWithContext.unsafeOptionalDataVia(
246-
source,
247-
Flow.fromFunction { (string: String) => string.toInt }
248-
)(Keep.none)
249-
.runWith(TestSink.probe[(Option[Int], Int)])
250-
.request(4)
251-
.expectNext((Some(1), 1), (None, 2), (None, 3), (Some(4), 4))
252-
.expectComplete()
245+
for (_ <- 0 until 64) {
246+
SourceWithContext.unsafeOptionalDataVia(
247+
source,
248+
Flow.fromFunction { (string: String) => string.toInt }
249+
)(Keep.none)
250+
.runWith(TestSink.probe[(Option[Int], Int)])
251+
.request(4)
252+
.expectNext((Some(1), 1), (None, 2), (None, 3), (Some(4), 4))
253+
.expectComplete()
254+
}
253255
}
254256
}
255257
}

0 commit comments

Comments
 (0)