[
https://issues.apache.org/jira/browse/BEAM-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15763964#comment-15763964
]
Stas Levin commented on BEAM-1176:
----------------------------------
I've started migrating the tests to using the {{TestPipeline}} as a JUnit rule.
There's quite a few of places to change so this might take a while longer.
>From the migration I've done so far, there's a particularly notable pattern we
>don't currently support in the {{TestPipeline}} rule - having multiple
>pipeline instances within a single test method.
This goes beyond supporting multiple {{run}} invocations on the same
{{TestPipeline}} rule instance, since such tests make assumption about their
internal pipeline instances being isolated. This in turn translates to their
{{PTransform}} names often being unstable, and/or dangling pipeline nodes which
are acceptable since error handling is performed inside dedicated try/catch
blocks inside the test itself.
Examples for such cases can be found the following tests:
* {{AvroIOGeneratedClassTest#runTestRead}}
*
{{ApproximateUniqueTest#runApproximateUniqueWithDuplicates}},{{ApproximateUniqueTest#runApproximateUniqueWithSkewedDistributions}}
* {{SampleTest#runPickAnyTest}}
* {{BigtableIOTest#runReadTest}}
For now I'm refraining from migrating these particular test cases by preserving
direct calls to {{TestPipeline.create()}} in places other than the {{@Rule}}
declaration itself, which ideally I guess we should avoid.
Any thoughts?
> Make our test suites use @Rule TestPipeline
> -------------------------------------------
>
> Key: BEAM-1176
> URL: https://issues.apache.org/jira/browse/BEAM-1176
> Project: Beam
> Issue Type: Improvement
> Components: sdk-java-core
> Reporter: Kenneth Knowles
> Assignee: Stas Levin
> Priority: Minor
>
> Now that [~staslev] has made {{TestPipeline}} a JUnit rule that performs
> useful sanity checks, we should port all of our tests to it so that they set
> a good example for users. Maybe we'll even catch some straggling tests with
> errors :-)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)