I have a GlobalWindow with a custom trigger (I leave windows open for a 
variable length of time depending on how much data I have vs the expected 
amount, so I’m manipulating triggerContext.registerProcessingTimeTimer()).

When I emit data into my data stream, the flink execution environment appears 
to halt after the test data is exhausted but before my GlobalWidow is triggered.

I tried changing my trigger to wait zero seconds on window full, but that just 
appears to have made my test racy where sometimes the global window triggers 
and calls apply (so the test passes) and sometimes the environment appears to 
halt first.

Is there a way for me to leave the execution environment running for a few 
seconds after all of my data is emitted? Or is there a good way for me to test 
this? So far my only solution has been to use env.fromCollection() in flink, 
and then pass a custom iterator class where the iterator.next() itself hangs 
before delivering the last value for Thread.sleep(10_000) (the last value I 
insert become untested garbage). That gives the window a chance to trigger and 
I always get the correct results (huzzah) but it's super hacky.

Any advice here is greatly appreciated.

Thanks,
Phil

Reply via email to