diff --git a/core/src/test/java/io/kestra/core/Helpers.java b/core/src/test/java/io/kestra/core/Helpers.java index ae3d6c475b..bdeb79c4a5 100644 --- a/core/src/test/java/io/kestra/core/Helpers.java +++ b/core/src/test/java/io/kestra/core/Helpers.java @@ -20,7 +20,7 @@ import java.util.function.Consumer; public class Helpers { - public static long FLOWS_COUNT = 48; + public static long FLOWS_COUNT = 47; public static ApplicationContext applicationContext() throws URISyntaxException { return applicationContext( diff --git a/core/src/test/java/io/kestra/core/tasks/flows/TemplateTest.java b/core/src/test/java/io/kestra/core/tasks/flows/TemplateTest.java index b6d976f9e0..a2675819cb 100644 --- a/core/src/test/java/io/kestra/core/tasks/flows/TemplateTest.java +++ b/core/src/test/java/io/kestra/core/tasks/flows/TemplateTest.java @@ -4,6 +4,7 @@ import io.kestra.core.models.executions.LogEntry; import io.kestra.core.queues.QueueFactoryInterface; import io.kestra.core.queues.QueueInterface; +import io.kestra.core.runners.ListenersTest; import io.kestra.core.tasks.debugs.Echo; import org.junit.jupiter.api.Test; import io.kestra.core.models.executions.Execution; @@ -13,10 +14,13 @@ import io.kestra.core.runners.RunnerUtils; import org.slf4j.event.Level; +import java.io.IOException; +import java.net.URISyntaxException; import java.time.Duration; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.concurrent.TimeoutException; import jakarta.inject.Inject; import jakarta.inject.Named; @@ -29,6 +33,7 @@ public class TemplateTest extends AbstractMemoryRunnerTest { @Inject protected TemplateRepositoryInterface templateRepository; + @Inject @Named(QueueFactoryInterface.WORKERTASKLOG_NAMED) protected QueueInterface logQueue; @@ -39,11 +44,10 @@ public class TemplateTest extends AbstractMemoryRunnerTest { .tasks(Collections.singletonList(Echo.builder().id("test").type(Echo.class.getName()).format("{{ parent.outputs.args['my-forward'] }}").build())).build(); public static void withTemplate(RunnerUtils runnerUtils, TemplateRepositoryInterface templateRepository, QueueInterface logQueue) throws TimeoutException { - templateRepository.create(TEMPLATE_1); - List logs = new ArrayList<>(); logQueue.receive(logs::add); + Execution execution = runnerUtils.runOne( "io.kestra.tests", "with-template", @@ -61,7 +65,10 @@ public static void withTemplate(RunnerUtils runnerUtils, TemplateRepositoryInter } @Test - void withTemplate() throws TimeoutException { + void withTemplate() throws TimeoutException, IOException, URISyntaxException { + templateRepository.create(TEMPLATE_1); + repositoryLoader.load(Objects.requireNonNull(ListenersTest.class.getClassLoader().getResource("flows/tests/with-template.yaml"))); + TemplateTest.withTemplate(runnerUtils, templateRepository, logQueue); } } diff --git a/core/src/test/resources/flows/valids/with-template.yaml b/core/src/test/resources/flows/tests/with-template.yaml similarity index 100% rename from core/src/test/resources/flows/valids/with-template.yaml rename to core/src/test/resources/flows/tests/with-template.yaml