[ 
https://issues.apache.org/jira/browse/BEAM-1543?focusedWorklogId=112108&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-112108
 ]

ASF GitHub Bot logged work on BEAM-1543:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Jun/18 23:31
            Start Date: 14/Jun/18 23:31
    Worklog Time Spent: 10m 
      Work Description: lukecwik commented on a change in pull request #2089: 
[BEAM-1543] Updated TestPipeline's javadoc.
URL: https://github.com/apache/beam/pull/2089#discussion_r195600653
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/testing/TestPipeline.java
 ##########
 @@ -292,8 +298,8 @@ public void evaluate() throws Throwable {
   public PipelineResult run() {
     checkState(
         enforcement.isPresent(),
-        "Attempted to run a pipeline while it's enforcement level was not set. 
Are you "
-            + "using TestPipeline without a @Rule annotation?");
+        "Is your TestPipeline declaration missing a @Rule annotation? Usage: "
 
 Review comment:
   It seems like based upon this logic: 
https://github.com/apache/beam/blob/b4d201820bdf911ae4ce091ce8c5d99a5c0aaab2/sdks/java/core/src/main/java/org/apache/beam/sdk/testing/TestPipeline.java#L279
   
   You should either do one of these three things:
   1) Annotate your method with `@Category(NeedsRunner.class)` and use JUnit 
categories to filter your tests to tests that need a runner and ones that 
don't. `NeedsRunner` is a special category that is used in Apache Beam 
integration testing to label tests that need a runner like direct/flink/spark 
so you could use the same mechanism there when running your tests.
   2) Make sure that you set the --runner option to anything but the 
CrashingRunner. You could also set this programmatically via 
options.setRunner(DirectRunner.class) but better to use the environment 
variable beamTestPipelineOptions as described in TestPipeline.java
   3) Explicitly call enableAbandonedNodeEnforcement on TestPipeline which is a 
manual override.
   
   Feel free to open a PR that updates the messaging to make it comprehensible.
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 112108)
    Time Spent: 1h  (was: 50m)

> TestPipeline: @Rule error message confusing/javadoc doesn't explain proper 
> usage
> --------------------------------------------------------------------------------
>
>                 Key: BEAM-1543
>                 URL: https://issues.apache.org/jira/browse/BEAM-1543
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Stephen Sisk
>            Assignee: Stas Levin
>            Priority: Major
>             Fix For: 0.6.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> I'm working on JdbcIOIT. Trying to run the checked-in version, I encountered 
> this error: 
> "Attempted to run a pipeline while it's enforcement level was not set. Are 
> you using TestPipeline without a @Rule annotation?"
> This error does not give me enough information to diagnose:
> a) what problem is occurring
> b) what I can do to solve it
> Checking the javadocs for TestPipeline, I don't see any information about 
> @Rule or anything of that nature.
> I did some github blame-ing on that string, and found BEAM-1205 and the 
> accompanying PR, however it was also unclear from BEAM-1205 exactly what I'm 
> supposed to do to make this test work.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to