Attached / Non-Async TestSource


When writing my own Akka Streams stages I’m finding it quite difficult to test that they pull / backpressure under the correct situations.

The main problem is that TestSource is a detached stage and inserts an async boundary between itself and my stage. This seems to be stemming from the fact that ProbeSource extends SourceModule which wraps it in an island.

The only workaround I have found is to change the buffer size to 1 and then I have to remember to ignore the first request. This seems to work but can be a bit cumbersome.

I’m a little surprised that this isn’t more of a problem. Is there some other approach to testing backpressure that I am no aware of?


I don’t know of another option.

I think something like the typed BehaviorTestKit - a simulator running the graph stage - could be neat, not sure how hard it would be to achieve though.