When unit testing Apache Flink with ProcessFunctionTestHarnesses
KeyedOneInputStreamOperatorTestHarness<String, Event, Alert> testHarness = ProcessFunctionTestHarnesses.forKeyedProcessFunction
The testHarness
has access to 2 classes to get the number of active timers in the keyed process function.
int i = testHarness.getProcessingTimeService().getNumActiveTimers()
int k = testHarness.numProcessingTimeTimers()
I’ve looked at the java doc of the both TestProcessingTimeService and InternalTimeServiceManager but the description doesn’t say much.
What is the difference b/w two and which should be used?
In my KeyedProcessFunction, I set and then delete a processing timer. At the end my UT, I expect there to be 0 active processing timers. From the above snippet, k
passes the assertion of being equal to 0
but i
fails, with it’s actual value being 1
.