What are the standard approaches for testing a streaming algorithm? I have been
able to come up with the below where I 1) create a data source that emits events in bunches with set times so that I know the events will be in the same window, 2) end the stream with a mapWithState where the state checks if the expected elements pass by in the expected order. This does not seem like the most robust way of doing this. Suggestions? Best, Bart import java.io.{FileWriter, StringWriter} |
Hi,
I think there are some things that could be helpful for testing your algorithm. From the top of my head, first thing is that you could try to test in a more „unit-testing“ style, i.e. just write small drivers that inject records to your UDFs and check if the output is as expected. Other than that, you should use event time instead of processing time for reproducible tests. With event time, there has to be no relationship from your source to some external timing (like System time) and no need to introduce sleeps to your code. You can find examples of this in several places in Flink’s tests. In particular, if you are interested in simulating sessions, you could take a look at org.apache.flink.test.windowing.sessionwindows.SessionWindowITCase and reuse some parts of it. Best, Stefan
|
Free forum by Nabble | Edit this page |