[
https://issues.apache.org/jira/browse/BEAM-8450?focusedWorklogId=336715&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-336715
]
ASF GitHub Bot logged work on BEAM-8450:
----------------------------------------
Author: ASF GitHub Bot
Created on: 31/Oct/19 10:24
Start Date: 31/Oct/19 10:24
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_r341057261
##########
File path:
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoLifecycleTest.java
##########
@@ -267,18 +290,23 @@ 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();
+ int lastOrder = -1;
+ for (CallState callState : requiredCallStates) {
+ int foundAtOrder =
+ ExceptionThrowingFn.callStateMap.values().stream()
+ .filter(value -> value.callStateVisited.containsKey(callState))
+ .mapToInt(value -> value.callStateVisited.get(callState))
+ .max()
+ .orElse(-1);
+ assertThat(
+ callState
+ + " lifecycle method should be called in correct order "
+ + Arrays.toString(requiredCallStates)
+ + " got "
+ + ExceptionThrowingFn.callStateMap.values(),
+ foundAtOrder > lastOrder);
+ lastOrder = foundAtOrder;
Review comment:
I'll prefer to leave it as it is. The ordering seems to me to be tested
reasonable well and if all runners pass, then it should be stable.
----------------------------------------------------------------
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: 336715)
Time Spent: 4h (was: 3h 50m)
> 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: 4h
> Remaining Estimate: 0h
>
> ParDoLifecycleTest should allow empty bundles produced by runner.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)