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

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

                Author: ASF GitHub Bot
            Created on: 25/Oct/19 12:13
            Start Date: 25/Oct/19 12:13
    Worklog Time Spent: 10m 
      Work Description: je-ik commented on pull request #9848: [BEAM-8450] 
Allow empty bundles in ParDoLifecycleTest
URL: https://github.com/apache/beam/pull/9848#discussion_r339020866
 
 

 ##########
 File path: 
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoLifecycleTest.java
 ##########
 @@ -267,19 +290,17 @@ private void validate() {
                     "Function should have been torn down after exception",
                     value.finalState(),
                     is(CallState.TEARDOWN)));
-  }
 
-  @Test
-  @Category({ValidatesRunner.class, UsesStatefulParDo.class, 
UsesParDoLifecycle.class})
-  public void testTeardownCalledAfterExceptionInFinishBundleStateful() {
-    ExceptionThrowingFn fn = new 
ExceptionThrowingStatefulFn(MethodForException.FINISH_BUNDLE);
-    p.apply(Create.of(KV.of("a", 1), KV.of("b", 2), KV.of("a", 
3))).apply(ParDo.of(fn));
-    try {
-      p.run();
-      fail("Pipeline should have failed with an exception");
-    } catch (Exception e) {
-      validate();
-    }
+    Arrays.stream(requiredCallStates)
+        .forEach(
+            callState ->
+                assertThat(
+                    "At least one "
+                        + callState
+                        + " lifecycle method should be called, got "
+                        + ExceptionThrowingFn.callStateMap.values(),
+                    ExceptionThrowingFn.callStateMap.values().stream()
+                        .anyMatch(value -> 
value.callStateVisited.containsKey(callState))));
 
 Review comment:
   I believe the order is checked, because the terminal state is checked to be 
TEARDOWN, and the respective transitions are checked in  `ExceptionThrowinFn` 
`@Setup`, `@StartBundle`, `@ProcessElement`, etc.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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: 334110)
    Time Spent: 1.5h  (was: 1h 20m)

> ParDoLifecycleTest does not allow for empty bundles
> ---------------------------------------------------
>
>                 Key: BEAM-8450
>                 URL: https://issues.apache.org/jira/browse/BEAM-8450
>             Project: Beam
>          Issue Type: Bug
>          Components: testing
>            Reporter: Jan Lukavský
>            Assignee: Jan Lukavský
>            Priority: Major
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> ParDoLifecycleTest should allow empty bundles produced by runner.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to