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

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

                Author: ASF GitHub Bot
            Created on: 30/Oct/19 20:34
            Start Date: 30/Oct/19 20:34
    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_r340843808
 
 

 ##########
 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:
   It would be definitely possible. On the other hand, this method is used only 
in with this DoFn (or `ExceptionThrowingStatefulFn` which performs the same 
checks), so it might be a little redundant. But I understand the concerns, so I 
will look into that. The main complication is that in some bundles the order 
might be different than in others (due to @ProcessElement missing). But it 
should not be that hard. :)
 
----------------------------------------------------------------
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: 336444)
    Time Spent: 1h 50m  (was: 1h 40m)

> 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: 1h 50m
>  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