Skip to content

Commit

Permalink
assert payload
Browse files Browse the repository at this point in the history
  • Loading branch information
amithkb committed Dec 20, 2024
1 parent 38d53a1 commit 2f2ac9e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -736,14 +736,15 @@ public void testThrowParallelWithPayload() throws Exception {
.archive(resource("parallelExceptionPayload"));

ConcordProcess proc = concord.processes().start(payload);
expectStatus(proc, ProcessEntry.StatusEnum.FAILED);
expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);

// ---
Map<String, Object> data = proc.getOutVariables();
List<Map<String, Object>> exceptions = (List<Map<String, Object>>) ConfigurationUtils.get(data, "lastError", "exceptions");
List<Map<String, Object>> exceptions = (List<Map<String, Object>>) ConfigurationUtils.get(data, "exceptions");

assertNotNull(exceptions);
assertEquals(List.of("BOOM1", "BOOM2"), exceptions.stream().map(e -> e.get("message")).toList());
assertEquals(List.of(Map.of("key", 1), Map.of("key", 2)), exceptions.stream().map(e -> e.get("payload")).toList());
}

private List<ProcessEventEntry> getProcessElementEvents(ConcordProcess proc) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
configuration:
runtime: "concord-v2"
out:
- exceptions

flows:
default:
- block:
- task: "throw"
in:
exception: "BOOM${item}"
payload:
key: "${item}"
loop:
items:
- try:
- task: "throw"
in:
exception: "BOOM${item}"
payload:
key: "${item}"
loop:
items:
- 1
- 2
mode: parallel
parallelism: 2
mode: parallel
parallelism: 2
error:
- set:
exceptions: ${lastError.cause.exceptions.stream().map(e -> e.cause).toList()}

0 comments on commit 2f2ac9e

Please sign in to comment.