[jira] [Commented] (BEAM-85) DataflowAssert (BeamAssert ;) needs sanity check that it's used correctly
[ https://issues.apache.org/jira/browse/BEAM-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15292574#comment-15292574 ] Kenneth Knowles commented on BEAM-85: - BEAM-298 is not quite a dupe of this, but close. > DataflowAssert (BeamAssert ;) needs sanity check that it's used correctly > - > > Key: BEAM-85 > URL: https://issues.apache.org/jira/browse/BEAM-85 > Project: Beam > Issue Type: New Feature > Components: sdk-java-core >Reporter: Daniel Halperin > > We should validate two things: > # DataflowAssert is not added to a pipeline that has already been run. > # The pipeline is run after the DataflowAssert is added. > If either of these are not validated, then it is possible that the test > doesn't actually verify anything. > This code should throw an assertion error or fail in some other way. > {code} > Pipeline p = TestPipeline.create(); > PCollection value = p.apply(Create.of(Boolean.FALSE)); > p.run(); > DataflowAssert.thatSingleton(value).isEqualTo(true); > {code} > but it would pass silently. > similarly, this code wills pass silently: > {code} > Pipeline p = TestPipeline.create(); > PCollection value = p.apply(Create.of(Boolean.FALSE)); > DataflowAssert.thatSingleton(value).isEqualTo(true); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (BEAM-85) DataflowAssert (BeamAssert ;) needs sanity check that it's used correctly
[ https://issues.apache.org/jira/browse/BEAM-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15219303#comment-15219303 ] ASF GitHub Bot commented on BEAM-85: Github user asfgit closed the pull request at: https://github.com/apache/incubator-beam/pull/93 > DataflowAssert (BeamAssert ;) needs sanity check that it's used correctly > - > > Key: BEAM-85 > URL: https://issues.apache.org/jira/browse/BEAM-85 > Project: Beam > Issue Type: New Feature > Components: sdk-java-core >Reporter: Daniel Halperin > > We should validate two things: > # DataflowAssert is not added to a pipeline that has already been run. > # The pipeline is run after the DataflowAssert is added. > If either of these are not validated, then it is possible that the test > doesn't actually verify anything. > This code should throw an assertion error or fail in some other way. > {code} > Pipeline p = TestPipeline.create(); > PCollection value = p.apply(Create.of(Boolean.FALSE)); > p.run(); > DataflowAssert.thatSingleton(value).isEqualTo(true); > {code} > but it would pass silently. > similarly, this code wills pass silently: > {code} > Pipeline p = TestPipeline.create(); > PCollection value = p.apply(Create.of(Boolean.FALSE)); > DataflowAssert.thatSingleton(value).isEqualTo(true); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (BEAM-85) DataflowAssert (BeamAssert ;) needs sanity check that it's used correctly
[ https://issues.apache.org/jira/browse/BEAM-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15175127#comment-15175127 ] Kenneth Knowles commented on BEAM-85: - Yes, they are separable. > DataflowAssert (BeamAssert ;) needs sanity check that it's used correctly > - > > Key: BEAM-85 > URL: https://issues.apache.org/jira/browse/BEAM-85 > Project: Beam > Issue Type: New Feature > Components: sdk-java-core >Reporter: Daniel Halperin > > It is important that assert is applied to pipeline before the pipeline is > run, otherwise it does not actually execute the test. > This code should throw an assertion error or fail in some other way. > ```java > { > Pipeline p = TestPipeline.create(); > PCollection value = p.apply(Create.of(Boolean.FALSE)); > p.run(); > DataflowAssert.thatSingleton(value).isEqualTo(true); > } > ``` > but it would pass silently. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (BEAM-85) DataflowAssert (BeamAssert ;) needs sanity check that it's used correctly
[ https://issues.apache.org/jira/browse/BEAM-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15174750#comment-15174750 ] Ben Chambers commented on BEAM-85: -- One possibility would be to use an `@Rule` instead. for instance: ```java @Rule public TestPipelineRule testPipeline; ... Pipeline p = testPipeline.create ... ``` Then the `tearDown` from the rule can validate proper usage. > DataflowAssert (BeamAssert ;) needs sanity check that it's used correctly > - > > Key: BEAM-85 > URL: https://issues.apache.org/jira/browse/BEAM-85 > Project: Beam > Issue Type: New Feature > Components: sdk-java-core >Reporter: Daniel Halperin >Assignee: Davor Bonaci > > It is important that assert is applied to pipeline before the pipeline is > run, otherwise it does not actually execute the test. > This code should throw an assertion error or fail in some other way. > ```java > { > Pipeline p = TestPipeline.create(); > PCollection value = p.apply(Create.of(Boolean.FALSE)); > p.run(); > DataflowAssert.thatSingleton(value).isEqualTo(true); > } > ``` > but it would pass silently. -- This message was sent by Atlassian JIRA (v6.3.4#6332)