diff --git a/core/src/test/java/io/kestra/core/runners/AbstractRunnerConcurrencyTest.java b/core/src/test/java/io/kestra/core/runners/AbstractRunnerConcurrencyTest.java new file mode 100644 index 0000000000..330950fc9e --- /dev/null +++ b/core/src/test/java/io/kestra/core/runners/AbstractRunnerConcurrencyTest.java @@ -0,0 +1,91 @@ +package io.kestra.core.runners; + +import io.kestra.core.junit.annotations.FlakyTest; +import io.kestra.core.junit.annotations.KestraTest; +import io.kestra.core.junit.annotations.LoadFlows; +import jakarta.inject.Inject; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; + +@KestraTest(startRunner = true) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public abstract class AbstractRunnerConcurrencyTest { + public static final String TENANT_1 = "tenant1"; + + @Inject + protected FlowConcurrencyCaseTest flowConcurrencyCaseTest; + + @Test + @LoadFlows({"flows/valids/flow-concurrency-cancel.yml"}) + void concurrencyCancel() throws Exception { + flowConcurrencyCaseTest.flowConcurrencyCancel(); + } + + @Test + @LoadFlows({"flows/valids/flow-concurrency-fail.yml"}) + void concurrencyFail() throws Exception { + flowConcurrencyCaseTest.flowConcurrencyFail(); + } + + @Test + @LoadFlows({"flows/valids/flow-concurrency-queue.yml"}) + void concurrencyQueue() throws Exception { + flowConcurrencyCaseTest.flowConcurrencyQueue(); + } + + @Test + @LoadFlows({"flows/valids/flow-concurrency-queue-pause.yml"}) + protected void concurrencyQueuePause() throws Exception { + flowConcurrencyCaseTest.flowConcurrencyQueuePause(); + } + + @Test + @LoadFlows({"flows/valids/flow-concurrency-cancel-pause.yml"}) + protected void concurrencyCancelPause() throws Exception { + flowConcurrencyCaseTest.flowConcurrencyCancelPause(); + } + + @Test + @LoadFlows(value = {"flows/valids/flow-concurrency-for-each-item.yaml", "flows/valids/flow-concurrency-queue.yml"}, tenantId = TENANT_1) + protected void flowConcurrencyWithForEachItem() throws Exception { + flowConcurrencyCaseTest.flowConcurrencyWithForEachItem(TENANT_1); + } + + @Test + @LoadFlows({"flows/valids/flow-concurrency-queue-fail.yml"}) + protected void concurrencyQueueRestarted() throws Exception { + flowConcurrencyCaseTest.flowConcurrencyQueueRestarted(); + } + + @Test + @LoadFlows({"flows/valids/flow-concurrency-queue-after-execution.yml"}) + void concurrencyQueueAfterExecution() throws Exception { + flowConcurrencyCaseTest.flowConcurrencyQueueAfterExecution(); + } + + @Test + @LoadFlows(value = {"flows/valids/flow-concurrency-subflow.yml", "flows/valids/flow-concurrency-cancel.yml"}, tenantId = TENANT_1) + void flowConcurrencySubflow() throws Exception { + flowConcurrencyCaseTest.flowConcurrencySubflow(TENANT_1); + } + + @Test + @FlakyTest(description = "Only flaky in CI") + @LoadFlows({"flows/valids/flow-concurrency-parallel-subflow-kill.yaml", "flows/valids/flow-concurrency-parallel-subflow-kill-child.yaml", "flows/valids/flow-concurrency-parallel-subflow-kill-grandchild.yaml"}) + protected void flowConcurrencyParallelSubflowKill() throws Exception { + flowConcurrencyCaseTest.flowConcurrencyParallelSubflowKill(); + } + + @Test + @LoadFlows({"flows/valids/flow-concurrency-queue-killed.yml"}) + void flowConcurrencyKilled() throws Exception { + flowConcurrencyCaseTest.flowConcurrencyKilled(); + } + + @Test + @FlakyTest(description = "Only flaky in CI") + @LoadFlows({"flows/valids/flow-concurrency-queue-killed.yml"}) + void flowConcurrencyQueueKilled() throws Exception { + flowConcurrencyCaseTest.flowConcurrencyQueueKilled(); + } +} diff --git a/core/src/test/java/io/kestra/core/runners/AbstractRunnerTest.java b/core/src/test/java/io/kestra/core/runners/AbstractRunnerTest.java index 6ac9235694..43bbacffb7 100644 --- a/core/src/test/java/io/kestra/core/runners/AbstractRunnerTest.java +++ b/core/src/test/java/io/kestra/core/runners/AbstractRunnerTest.java @@ -66,9 +66,6 @@ public abstract class AbstractRunnerTest { @Inject protected LoopUntilCaseTest loopUntilTestCaseTest; - @Inject - protected FlowConcurrencyCaseTest flowConcurrencyCaseTest; - @Inject protected ScheduleDateCaseTest scheduleDateCaseTest; @@ -422,78 +419,6 @@ public abstract class AbstractRunnerTest { forEachItemCaseTest.forEachItemWithAfterExecution(); } - @Test - @LoadFlows({"flows/valids/flow-concurrency-cancel.yml"}) - void concurrencyCancel() throws Exception { - flowConcurrencyCaseTest.flowConcurrencyCancel(); - } - - @Test - @LoadFlows({"flows/valids/flow-concurrency-fail.yml"}) - void concurrencyFail() throws Exception { - flowConcurrencyCaseTest.flowConcurrencyFail(); - } - - @Test - @LoadFlows({"flows/valids/flow-concurrency-queue.yml"}) - void concurrencyQueue() throws Exception { - flowConcurrencyCaseTest.flowConcurrencyQueue(); - } - - @Test - @LoadFlows({"flows/valids/flow-concurrency-queue-pause.yml"}) - protected void concurrencyQueuePause() throws Exception { - flowConcurrencyCaseTest.flowConcurrencyQueuePause(); - } - - @Test - @LoadFlows({"flows/valids/flow-concurrency-cancel-pause.yml"}) - protected void concurrencyCancelPause() throws Exception { - flowConcurrencyCaseTest.flowConcurrencyCancelPause(); - } - - @Test - @LoadFlows(value = {"flows/valids/flow-concurrency-for-each-item.yaml", "flows/valids/flow-concurrency-queue.yml"}, tenantId = TENANT_1) - protected void flowConcurrencyWithForEachItem() throws Exception { - flowConcurrencyCaseTest.flowConcurrencyWithForEachItem(TENANT_1); - } - - @Test - @LoadFlows({"flows/valids/flow-concurrency-queue-fail.yml"}) - protected void concurrencyQueueRestarted() throws Exception { - flowConcurrencyCaseTest.flowConcurrencyQueueRestarted(); - } - - @Test - @LoadFlows({"flows/valids/flow-concurrency-queue-after-execution.yml"}) - void concurrencyQueueAfterExecution() throws Exception { - flowConcurrencyCaseTest.flowConcurrencyQueueAfterExecution(); - } - - @Test - @LoadFlows(value = {"flows/valids/flow-concurrency-subflow.yml", "flows/valids/flow-concurrency-cancel.yml"}, tenantId = TENANT_1) - void flowConcurrencySubflow() throws Exception { - flowConcurrencyCaseTest.flowConcurrencySubflow(TENANT_1); - } - - @Test - @LoadFlows({"flows/valids/flow-concurrency-parallel-subflow-kill.yaml", "flows/valids/flow-concurrency-parallel-subflow-kill-child.yaml", "flows/valids/flow-concurrency-parallel-subflow-kill-grandchild.yaml"}) - void flowConcurrencyParallelSubflowKill() throws Exception { - flowConcurrencyCaseTest.flowConcurrencyParallelSubflowKill(); - } - - @Test - @LoadFlows({"flows/valids/flow-concurrency-queue-killed.yml"}) - void flowConcurrencyKilled() throws Exception { - flowConcurrencyCaseTest.flowConcurrencyKilled(); - } - - @Test - @LoadFlows({"flows/valids/flow-concurrency-queue-killed.yml"}) - void flowConcurrencyQueueKilled() throws Exception { - flowConcurrencyCaseTest.flowConcurrencyQueueKilled(); - } - @Test @ExecuteFlow("flows/valids/executable-fail.yml") void badExecutable(Execution execution) { diff --git a/jdbc-h2/src/test/java/io/kestra/runner/h2/H2RunnerConcurrencyTest.java b/jdbc-h2/src/test/java/io/kestra/runner/h2/H2RunnerConcurrencyTest.java new file mode 100644 index 0000000000..f4b5d590f1 --- /dev/null +++ b/jdbc-h2/src/test/java/io/kestra/runner/h2/H2RunnerConcurrencyTest.java @@ -0,0 +1,6 @@ +package io.kestra.runner.h2; + +import io.kestra.core.runners.AbstractRunnerConcurrencyTest; + +public class H2RunnerConcurrencyTest extends AbstractRunnerConcurrencyTest { +} diff --git a/jdbc-mysql/src/test/java/io/kestra/runner/mysql/MysqlRunnerConcurrencyTest.java b/jdbc-mysql/src/test/java/io/kestra/runner/mysql/MysqlRunnerConcurrencyTest.java new file mode 100644 index 0000000000..e8deeb3fb2 --- /dev/null +++ b/jdbc-mysql/src/test/java/io/kestra/runner/mysql/MysqlRunnerConcurrencyTest.java @@ -0,0 +1,6 @@ +package io.kestra.runner.mysql; + +import io.kestra.core.runners.AbstractRunnerConcurrencyTest; + +public class MysqlRunnerConcurrencyTest extends AbstractRunnerConcurrencyTest { +} diff --git a/jdbc-postgres/src/test/java/io/kestra/runner/postgres/PostgresRunnerConcurrencyTest.java b/jdbc-postgres/src/test/java/io/kestra/runner/postgres/PostgresRunnerConcurrencyTest.java new file mode 100644 index 0000000000..1df8d26ee8 --- /dev/null +++ b/jdbc-postgres/src/test/java/io/kestra/runner/postgres/PostgresRunnerConcurrencyTest.java @@ -0,0 +1,6 @@ +package io.kestra.runner.postgres; + +import io.kestra.core.runners.AbstractRunnerConcurrencyTest; + +public class PostgresRunnerConcurrencyTest extends AbstractRunnerConcurrencyTest { +}