Skip to content

Commit 6b8ff5f

Browse files
fix(test): don't emit replay execution from TestRunnerUtils.awaitChildExecution
1 parent 9954b35 commit 6b8ff5f

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

core/src/test/java/io/kestra/core/runners/RestartCaseTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ public void replay() throws Exception {
149149

150150
assertThat(restartedExec.getId()).isNotEqualTo(firstExecution.getId());
151151
assertThat(restartedExec.getTaskRunList().get(1).getId()).isNotEqualTo(firstExecution.getTaskRunList().get(1).getId());
152-
Execution finishedRestartedExecution = runnerUtils.awaitChildExecution(
152+
Execution finishedRestartedExecution = runnerUtils.emitAndAwaitChildExecution(
153153
flow,
154154
firstExecution,
155-
restartedExec,
155+
restartedExec.withTenantId(MAIN_TENANT),
156156
Duration.ofSeconds(60)
157157
);
158158

@@ -315,10 +315,10 @@ public void restartOrReplayLoopUntil() throws Exception{
315315
assertThat(replayedExecution.getState().getCurrent()).isEqualTo(Type.RESTARTED);
316316
assertThat(replayedExecution.getId()).isNotEqualTo(firstExecution.getId());
317317

318-
Execution finalReplayedExecution = runnerUtils.awaitChildExecution(
318+
Execution finalReplayedExecution = runnerUtils.emitAndAwaitChildExecution(
319319
flow,
320320
firstExecution,
321-
replayedExecution,
321+
replayedExecution.withTenantId(MAIN_TENANT),
322322
Duration.ofSeconds(60)
323323
);
324324
assertThat(finalReplayedExecution.getState().getCurrent()).isEqualTo(Type.FAILED);

tests/src/main/java/io/kestra/core/runners/TestRunnerUtils.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,14 @@ public Execution killExecution(Execution execution) throws QueueException {
364364
), execution);
365365
}
366366

367-
public Execution awaitChildExecution(Flow flow, Execution parentExecution, Execution execution, Duration duration)
368-
throws QueueException {
367+
public Execution emitAndAwaitChildExecution(Flow flow, Execution parentExecution, Execution execution, Duration duration) throws QueueException {
369368
return this.emitAndAwaitExecution(isTerminatedChildExecution(parentExecution, flow), execution, duration);
370369
}
371370

371+
public Execution awaitChildExecution(Flow flow, Execution parentExecution, Execution execution, Duration duration) {
372+
return this.awaitExecution(isTerminatedChildExecution(parentExecution, flow), execution, duration);
373+
}
374+
372375
private Predicate<Execution> isTerminatedExecution(Execution execution, Flow flow) {
373376
return e -> e.getId().equals(execution.getId()) && executionService.isTerminated(flow, e);
374377
}

webserver/src/test/java/io/kestra/webserver/controllers/api/ExecutionControllerRunnerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ void restartExecutionFromTaskIdWithSequential() throws Exception {
672672
runnerUtils.awaitChildExecution(
673673
flow.get(),
674674
parentExecution,
675-
createdChidExec,
675+
createdChidExec.withTenantId(TENANT_ID),
676676
Duration.ofSeconds(30));
677677
}
678678

0 commit comments

Comments
 (0)