m-trieu commented on code in PR #31317:
URL: https://github.com/apache/beam/pull/31317#discussion_r1619447438
##########
runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/windmill/work/processing/failures/WorkFailureProcessorTest.java:
##########
@@ -80,43 +87,46 @@ private static FailureTracker
streamingApplianceFailureReporter(boolean isWorkFa
ignored ->
Windmill.ReportStatsResponse.newBuilder().setFailed(isWorkFailed).build());
}
- private static Work createWork(Supplier<Instant> clock, Consumer<Work>
processWorkFn) {
- return Work.create(
- Windmill.WorkItem.newBuilder()
- .setKey(ByteString.EMPTY)
- .setWorkToken(1L)
- .setCacheToken(1L)
- .setShardingKey(1L)
- .build(),
- clock,
- new ArrayList<>(),
+ private static ExecutableWork createWork(Supplier<Instant> clock,
Consumer<Work> processWorkFn) {
+ WorkCommitter workCommitter = mock(WorkCommitter.class);
+ doNothing().when(workCommitter).commit(any(Commit.class));
+ WindmillStream.GetDataStream getDataStream =
mock(WindmillStream.GetDataStream.class);
+ when(getDataStream.requestKeyedData(anyString(), any()))
+ .thenReturn(Windmill.KeyedGetDataResponse.getDefaultInstance());
+ return ExecutableWork.create(
+ Work.create(
+
Windmill.WorkItem.newBuilder().setKey(ByteString.EMPTY).setWorkToken(1L).build(),
+ Watermarks.builder().setInputDataWatermark(Instant.EPOCH).build(),
+ Work.createProcessingContext("computationId",
getDataStream::requestKeyedData)
+ .setWorkCommitter(workCommitter::commit)
+ .build(),
+ clock,
+ new ArrayList<>()),
processWorkFn);
}
- private static Work createWork() {
- return createWork(Instant::now, ignored -> {});
- }
-
- private static Work createWork(Consumer<Work> processWorkFn) {
+ private static ExecutableWork createWork(Consumer<Work> processWorkFn) {
return createWork(Instant::now, processWorkFn);
}
@Test
public void logAndProcessFailure_doesNotRetryKeyTokenInvalidException() {
- Work work = spy(createWork());
+ Set<Work> executeWork = new HashSet<>();
Review Comment:
done
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]