Skip to content

Commit

Permalink
runtime-v2: log segment tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brig committed May 13, 2024
1 parent 577b0ec commit 6a06cbf
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,59 @@ public void testSegmentedLogging() throws Exception {
assertLog(log, ".*This is a processLog entry.*");
}

@Test
public void throwStepShouldContainErrorDescription() throws Exception {
deploy("logSegments1");

save(ProcessConfiguration.builder()
.build());

RunnerConfiguration runnerCfg = RunnerConfiguration.builder()
.logging(LoggingConfiguration.builder()
.segmentedLogs(true)
.build())
.build();

try {
run(runnerCfg);
fail("exception expected");
} catch (Exception e) {
// ignore
}

// 83 log message length, 1 - segment id
assertLog(lastLog, ".*" + Pattern.quote("|83|1|") + ".*" + Pattern.quote("[ERROR] (concord.yaml): Error @ line: 3, col: 7. BOOM"));
}

@Test
public void loopStepShouldLogErrorInProperLogSegment() throws Exception {
deploy("logSegments2");

save(ProcessConfiguration.builder()
.build());

RunnerConfiguration runnerCfg = RunnerConfiguration.builder()
.logging(LoggingConfiguration.builder()
.segmentedLogs(true)
.build())
.build();

try {
run(runnerCfg);
fail("exception expected");
} catch (Exception e) {
// ignore
}

// 129 log message length, 1, 2, 3, 4, 5, 6 - segment ids
assertLog(lastLog, ".*" + Pattern.quote("|129|1|") + ".*" + Pattern.quote("[ERROR] (concord.yaml): Error @ line: 3, col: 7. Error during execution of 'faultyTask' task: boom!"));
assertLog(lastLog, ".*" + Pattern.quote("|129|2|") + ".*" + Pattern.quote("[ERROR] (concord.yaml): Error @ line: 3, col: 7. Error during execution of 'faultyTask' task: boom!"));
assertLog(lastLog, ".*" + Pattern.quote("|129|3|") + ".*" + Pattern.quote("[ERROR] (concord.yaml): Error @ line: 3, col: 7. Error during execution of 'faultyTask' task: boom!"));
assertLog(lastLog, ".*" + Pattern.quote("|129|4|") + ".*" + Pattern.quote("[ERROR] (concord.yaml): Error @ line: 3, col: 7. Error during execution of 'faultyTask' task: boom!"));
assertLog(lastLog, ".*" + Pattern.quote("|129|5|") + ".*" + Pattern.quote("[ERROR] (concord.yaml): Error @ line: 3, col: 7. Error during execution of 'faultyTask' task: boom!"));
assertLog(lastLog, ".*" + Pattern.quote("|129|6|") + ".*" + Pattern.quote("[ERROR] (concord.yaml): Error @ line: 3, col: 7. Error during execution of 'faultyTask' task: boom!"));
}

@Test
public void testSystemOutRedirectInScripts() throws Exception {
deploy("systemOutRedirect");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
flows:
default:
- throw: "BOOM"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
flows:
default:
- task: "faultyTask"
loop:
items: [1, 2, 3, 4, 5, 6]
mode: parallel
parallelism: 6

0 comments on commit 6a06cbf

Please sign in to comment.