Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Java async accepted test more forgiving #533

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions features/update/async_accepted/feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,26 @@ public Run execute(Runner runner) throws Exception {
Assertions.assertEquals(UPDATE_RESULT, handle.getResultAsync().get());
// issue an async update that should throw
updateId = UUID.randomUUID().toString();
UpdateHandle<Integer> errorHandle =
untypedStub.startUpdate(
UpdateOptions.newBuilder(Integer.class)
.setUpdateName("update")
.setUpdateId(updateId)
.setFirstExecutionRunId(run.execution.getRunId())
.setWaitForStage(WorkflowUpdateStage.ACCEPTED)
.build(),
false);
try {
// If the worker accepts the update, but fails it in the same workflow task
// the update will be marked as failed and the exception may be thrown
// from startUpdate. This is not consistent with the behavior of the
// other SDKs.
UpdateHandle<Integer> errorHandle =
untypedStub.startUpdate(
UpdateOptions.newBuilder(Integer.class)
.setUpdateName("update")
.setUpdateId(updateId)
.setFirstExecutionRunId(run.execution.getRunId())
.setWaitForStage(WorkflowUpdateStage.ACCEPTED)
.build(),
false);
errorHandle.getResultAsync().get();
Assertions.fail("unreachable");
} catch (ExecutionException e) {
} catch (Throwable e) {
if (e instanceof ExecutionException) {
e = e.getCause();
}
Assertions.assertTrue(e.getCause() instanceof WorkflowUpdateException);
WorkflowUpdateException wue = (WorkflowUpdateException) e.getCause();
Assertions.assertTrue(wue.getCause() instanceof ApplicationFailure);
Expand Down
Loading