=str clarify invocation semantics of wireTap, make test less flaky #24979

This commit is contained in:
Konrad `ktoso` Malawski 2018-04-26 22:56:58 +09:00 committed by Johan Andrén
parent 9051e2fcda
commit ca2fe92f0d
6 changed files with 16 additions and 8 deletions

View file

@ -5,24 +5,22 @@
package akka.stream.scaladsl
import akka.Done
import scala.util.control.NoStackTrace
import akka.stream.ActorMaterializer
import akka.stream.testkit._
import akka.stream.testkit.Utils._
import akka.stream.testkit._
class FlowWireTapSpec extends StreamSpec {
import scala.concurrent.duration._
import scala.util.control.NoStackTrace
class FlowWireTapSpec extends StreamSpec("akka.stream.materializer.debug.fuzzing-mode = off") {
implicit val materializer = ActorMaterializer()
import system.dispatcher
"A wireTap" must {
"call the procedure for each element" in assertAllStagesStopped {
Source(1 to 3).wireTap(x { testActor ! x }).runWith(Sink.ignore).futureValue
expectMsg(1)
expectMsg(2)
expectMsg(3)
Source(1 to 100).wireTap(testActor ! _).runWith(Sink.ignore).futureValue
1 to 100 foreach { i expectMsg(i) }
}
"complete the future for an empty stream" in assertAllStagesStopped {

View file

@ -487,6 +487,8 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr
* This is a simplified version of `wireTap(Sink)` that takes only a simple procedure.
* Elements will be passed into this "side channel" function, and any of its results will be ignored.
*
* If the wire-tap operation is slow (it backpressures), elements that would've been sent to it will be dropped instead.
*
* This operation is useful for inspecting the passed through element, usually by means of side-effecting
* operations (such as `println`, or emitting metrics), for each element without having to modify it.
*

View file

@ -1076,6 +1076,8 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
* This is a simplified version of `wireTap(Sink)` that takes only a simple procedure.
* Elements will be passed into this "side channel" function, and any of its results will be ignored.
*
* If the wire-tap operation is slow (it backpressures), elements that would've been sent to it will be dropped instead.
*
* This operation is useful for inspecting the passed through element, usually by means of side-effecting
* operations (such as `println`, or emitting metrics), for each element without having to modify it.
*

View file

@ -139,6 +139,8 @@ class SubFlow[In, Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Flow[I
* This is a simplified version of `wireTap(Sink)` that takes only a simple procedure.
* Elements will be passed into this "side channel" function, and any of its results will be ignored.
*
* If the wire-tap operation is slow (it backpressures), elements that would've been sent to it will be dropped instead.
*
* This operation is useful for inspecting the passed through element, usually by means of side-effecting
* operations (such as `println`, or emitting metrics), for each element without having to modify it.
*

View file

@ -132,6 +132,8 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
* This is a simplified version of `wireTap(Sink)` that takes only a simple procedure.
* Elements will be passed into this "side channel" function, and any of its results will be ignored.
*
* If the wire-tap operation is slow (it backpressures), elements that would've been sent to it will be dropped instead.
*
* This operation is useful for inspecting the passed through element, usually by means of side-effecting
* operations (such as `println`, or emitting metrics), for each element without having to modify it.
*

View file

@ -770,6 +770,8 @@ trait FlowOps[+Out, +Mat] {
* This is a simplified version of `wireTap(Sink)` that takes only a simple function.
* Elements will be passed into this "side channel" function, and any of its results will be ignored.
*
* If the wire-tap operation is slow (it backpressures), elements that would've been sent to it will be dropped instead.
*
* This operation is useful for inspecting the passed through element, usually by means of side-effecting
* operations (such as `println`, or emitting metrics), for each element without having to modify it.
*