Hi Dan, Thanks a lot for the explanation. :)
Best, Shen On Tue, Jan 31, 2017 at 4:19 PM, Dan Halperin <[email protected]> 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 <[email protected]> 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 > > >
