Skip to content

Commit

Permalink
feat: update template to use ExecuteFlow & startRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Jan 15, 2025
1 parent f990c5a commit 2505bf4
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions src/test/java/io/kestra/plugin/templates/ExampleRunnerTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.kestra.plugin.templates;

import io.kestra.core.junit.annotations.ExecuteFlow;
import io.kestra.core.junit.annotations.KestraTest;
import io.kestra.core.queues.QueueException;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -26,28 +27,12 @@
* configuration file in `src/test/resources/application.yml` that is only for the full runner
* test to configure in-memory runner.
*/
@KestraTest
@KestraTest(startRunner = true)
class ExampleRunnerTest {
@Inject
protected StandAloneRunner runner;

@Inject
protected RunnerUtils runnerUtils;

@Inject
protected LocalFlowRepositoryLoader repositoryLoader;

@BeforeEach
protected void init() throws IOException, URISyntaxException {
repositoryLoader.load(Objects.requireNonNull(ExampleRunnerTest.class.getClassLoader().getResource("flows")));
this.runner.run();
}

@SuppressWarnings("unchecked")
@Test
void flow() throws TimeoutException, QueueException {
Execution execution = runnerUtils.runOne(null, "io.kestra.templates", "example");

@ExecuteFlow("flows/example.yaml")
void flow(Execution execution) throws TimeoutException, QueueException {
assertThat(execution.getTaskRunList(), hasSize(3));
assertThat(((Map<String, Object>)execution.getTaskRunList().get(2).getOutputs().get("child")).get("value"), is("task-id"));
}
Expand Down

0 comments on commit 2505bf4

Please sign in to comment.