You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beam.apache.org by Shen Li <cs...@gmail.com> on 2017/01/31 21:07:15 UTC

Doesn't PAssertTest.runExpectingAssertionFailure need to call waitUntilFinish?

Hi,

In the PAssertTest, doesn't it need to append a "waitUntilFinish()" to the
"pipeline.run()" (please see the link below)? Otherwise, the runner may
return the PipelineResult immediately without actually kicking off the
execution, and therefore the AssertionError won't be thrown. Or did I miss
anything?

https://github.com/apache/beam/blob/master/sdks/java/core/src/test/java/org/apache/beam/sdk/testing/PAssertTest.java#L399

Thanks,

Shen

Re: Doesn't PAssertTest.runExpectingAssertionFailure need to call waitUntilFinish?

Posted by Shen Li <cs...@gmail.com>.
Hi Dan,

Thanks a lot for the explanation. :)

Best,

Shen

On Tue, Jan 31, 2017 at 4:19 PM, Dan Halperin <dh...@google.com.invalid>
wrote:

> Hi Shen,
>
> Great question. The trick is that the `pipeline` object is an instance of
> TestPipeline [0], for which p.run() is the same as
> p.run().waitUntilFinish().
>
> It might be documentationally better to use p.run().waitUntilFinish() to be
> consistent with real runners, or add a method to TestPipeline
> p.runTestPipeline() to signal that this works only in tests. At the same
> time, that would complicate writing tests, which we don't really want to
> do... so it's a tradeoff that may be okay as-is.
>
> Dan
>
> [0]
> https://github.com/apache/beam/blob/master/sdks/java/
> core/src/test/java/org/apache/beam/sdk/testing/PAssertTest.java#L64
>
>
>
> On Tue, Jan 31, 2017 at 1:07 PM, Shen Li <cs...@gmail.com> wrote:
>
> > Hi,
> >
> > In the PAssertTest, doesn't it need to append a "waitUntilFinish()" to
> the
> > "pipeline.run()" (please see the link below)? Otherwise, the runner may
> > return the PipelineResult immediately without actually kicking off the
> > execution, and therefore the AssertionError won't be thrown. Or did I
> miss
> > anything?
> >
> > https://github.com/apache/beam/blob/master/sdks/java/
> > core/src/test/java/org/apache/beam/sdk/testing/PAssertTest.java#L399
> >
> > Thanks,
> >
> > Shen
> >
>

Re: Doesn't PAssertTest.runExpectingAssertionFailure need to call waitUntilFinish?

Posted by Dan Halperin <dh...@google.com.INVALID>.
Hi Shen,

Great question. The trick is that the `pipeline` object is an instance of
TestPipeline [0], for which p.run() is the same as
p.run().waitUntilFinish().

It might be documentationally better to use p.run().waitUntilFinish() to be
consistent with real runners, or add a method to TestPipeline
p.runTestPipeline() to signal that this works only in tests. At the same
time, that would complicate writing tests, which we don't really want to
do... so it's a tradeoff that may be okay as-is.

Dan

[0]
https://github.com/apache/beam/blob/master/sdks/java/core/src/test/java/org/apache/beam/sdk/testing/PAssertTest.java#L64



On Tue, Jan 31, 2017 at 1:07 PM, Shen Li <cs...@gmail.com> wrote:

> Hi,
>
> In the PAssertTest, doesn't it need to append a "waitUntilFinish()" to the
> "pipeline.run()" (please see the link below)? Otherwise, the runner may
> return the PipelineResult immediately without actually kicking off the
> execution, and therefore the AssertionError won't be thrown. Or did I miss
> anything?
>
> https://github.com/apache/beam/blob/master/sdks/java/
> core/src/test/java/org/apache/beam/sdk/testing/PAssertTest.java#L399
>
> Thanks,
>
> Shen
>