-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): ResumeTest didn't pass anymore
As we cannot anymore pause in one branch and continue in the other
- Loading branch information
1 parent
416e2a1
commit 48da2a7
Showing
2 changed files
with
28 additions
and
16 deletions.
There are no files selected for viewing
24 changes: 21 additions & 3 deletions
24
core/src/test/java/io/kestra/plugin/core/execution/ResumeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
package io.kestra.plugin.core.execution; | ||
|
||
import io.kestra.core.models.executions.Execution; | ||
import io.kestra.core.models.flows.Flow; | ||
import io.kestra.core.models.flows.State; | ||
import io.kestra.core.repositories.ExecutionRepositoryInterface; | ||
import io.kestra.core.runners.AbstractMemoryRunnerTest; | ||
import io.kestra.core.utils.Await; | ||
import jakarta.inject.Inject; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.Duration; | ||
import java.util.Map; | ||
|
||
import static io.kestra.core.utils.Rethrow.throwRunnable; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.hasSize; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
class ResumeTest extends AbstractMemoryRunnerTest { | ||
@Inject | ||
private ExecutionRepositoryInterface executionRepository; | ||
|
||
@Test | ||
void resume() throws Exception { | ||
Execution execution = runnerUtils.runOne(null, "io.kestra.tests", "resume-execution"); | ||
Execution pause = runnerUtils.runOneUntilPaused(null, "io.kestra.tests", "pause"); | ||
String pauseId = pause.getId(); | ||
|
||
Execution resume = runnerUtils.runOne(null, "io.kestra.tests", "resume-execution", null, (flow, execution) -> Map.of("executionId", pauseId)); | ||
assertThat(resume.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
|
||
assertThat(execution.getTaskRunList(), hasSize(5)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
Await.until( | ||
() -> executionRepository.findById(null, pauseId).orElseThrow().getState().getCurrent().isTerminated(), | ||
Duration.ofMillis(100), | ||
Duration.ofSeconds(5) | ||
); | ||
} | ||
} |
20 changes: 7 additions & 13 deletions
20
core/src/test/resources/flows/valids/resume-execution.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
id: resume-execution | ||
namespace: io.kestra.tests | ||
|
||
inputs: | ||
- id: executionId | ||
type: STRING | ||
|
||
tasks: | ||
- id: parallel | ||
type: io.kestra.plugin.core.flow.Parallel | ||
tasks: | ||
- id: pause | ||
type: io.kestra.plugin.core.flow.Pause | ||
- id: sequential | ||
type: io.kestra.plugin.core.flow.Sequential | ||
tasks: | ||
- id: log | ||
type: io.kestra.core.tasks.test.Sleep | ||
duration: 100 | ||
- id: resume | ||
type: io.kestra.plugin.core.execution.Resume | ||
- id: resume | ||
type: io.kestra.plugin.core.execution.Resume | ||
executionId: "{{inputs.executionId}}" |