flink-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aljoscha Krettek <aljos...@apache.org>
Subject Re: Junit Issue while testing Kafka Source
Date Thu, 26 May 2016 07:31:02 GMT
Hi,
what we are doing in most internal tests is to verify in a sink whether the
data is correct and then throw a SuccessException. This brings down the job
and we check whether we catch a SuccessException to verify that the test
was successful. Look, for example, at the ValidatingSink in
EventTimeWindowCheckpointingITCase in the Flink source.

Cheers,
Aljoscha

On Thu, 26 May 2016 at 01:58 Nick Dimiduk <ndimiduk@gmail.com> wrote:

> I'm also curious for a solution here. My test code executes the flow from a
> separate thread. Once i've joined on all my producer threads and I've
> verified the output, I simply interrupt the flow thread. This spews
> exceptions, but it all appears to be harmless.
>
> Maybe there's a better way? I think you'd need some "death pill" to send
> into the stream that signals its termination.
>
> On Tue, May 24, 2016 at 7:29 PM, Vinay Patil <vinay18.patil@gmail.com>
> wrote:
>
> > Hi,
> >
> > I am able to read from a topic using FlinkKafkaConsumer and return the
> > result, however  when I am testing this scenario in Junit the result is
> > getting printed(kafkaStream.print()) but  I am not able to exit the Job,
> > env.execute keeps running,
> > I tried to return env.execute from method but that did not work either.
> >
> > 1) Is there any way to end the execution of job forcefully.
> > 2) How do I test if the data has come from topic
> >
> >    - One way I think of is to get the output of stream.print() in a
> >    PrintStream and check the result.(but not able to test this since job
> is
> >    not getting exited)
> >
> > Please help with these issues
> >
> > Regards,
> > Vinay Patil
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message