Skip to content

Commit

Permalink
chore: Test more rounds for unsafeDataVia keeping order. (apache#1680)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2ee3745)
  • Loading branch information
He-Pin committed Jan 5, 2025
1 parent 38facf7 commit f3ca3d0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,19 @@ class FlowWithContextSpec extends StreamSpec {
.asFlowWithContext[Option[String], Int, Int](collapseContext = Tuple2.apply)(extractContext = _._2)
.map(_._1)

SourceWithContext
.fromTuples(Source(data)).via(
FlowWithContext.unsafeOptionalDataVia(
flow,
Flow.fromFunction { (string: String) => string.toInt }
)(Keep.none)
)
.runWith(TestSink.probe[(Option[Int], Int)])
.request(4)
.expectNext((Some(1), 1), (None, 2), (None, 3), (Some(4), 4))
.expectComplete()
for (_ <- 0 until 64) {
SourceWithContext
.fromTuples(Source(data)).via(
FlowWithContext.unsafeOptionalDataVia(
flow,
Flow.fromFunction { (string: String) => string.toInt }
)(Keep.none)
)
.runWith(TestSink.probe[(Option[Int], Int)])
.request(4)
.expectNext((Some(1), 1), (None, 2), (None, 3), (Some(4), 4))
.expectComplete()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,16 @@ class SourceWithContextSpec extends StreamSpec {

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

SourceWithContext.unsafeOptionalDataVia(
source,
Flow.fromFunction { (string: String) => string.toInt }
)(Keep.none)
.runWith(TestSink.probe[(Option[Int], Int)])
.request(4)
.expectNext((Some(1), 1), (None, 2), (None, 3), (Some(4), 4))
.expectComplete()
for (_ <- 0 until 64) {
SourceWithContext.unsafeOptionalDataVia(
source,
Flow.fromFunction { (string: String) => string.toInt }
)(Keep.none)
.runWith(TestSink.probe[(Option[Int], Int)])
.request(4)
.expectNext((Some(1), 1), (None, 2), (None, 3), (Some(4), 4))
.expectComplete()
}
}
}
}

0 comments on commit f3ca3d0

Please sign in to comment.