From caccfdb7c22e81edb602d7fff8127f39c686ed79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Wed, 5 Mar 2025 17:41:33 +0100 Subject: [PATCH] WIP --- .../java/io/kestra/core/models/Label.java | 1 + .../core/models/executions/Execution.java | 28 ++++- .../kestra/core/runners/ExecutorService.java | 31 +++++- .../java/io/kestra/core/test/Fixture.java | 23 ++++ .../main/java/io/kestra/core/test/Input.java | 15 +++ .../main/java/io/kestra/core/test/Test.java | 24 +++++ test1.yaml | 21 ++++ test2.yaml | 13 +++ .../controllers/api/ExecutionController.java | 6 +- .../controllers/api/TestController.java | 100 ++++++++++++++++++ 10 files changed, 254 insertions(+), 8 deletions(-) create mode 100644 core/src/main/java/io/kestra/core/test/Fixture.java create mode 100644 core/src/main/java/io/kestra/core/test/Input.java create mode 100644 core/src/main/java/io/kestra/core/test/Test.java create mode 100644 test1.yaml create mode 100644 test2.yaml create mode 100644 webserver/src/main/java/io/kestra/webserver/controllers/api/TestController.java diff --git a/core/src/main/java/io/kestra/core/models/Label.java b/core/src/main/java/io/kestra/core/models/Label.java index 4ca80a49201..99c6cd3c610 100644 --- a/core/src/main/java/io/kestra/core/models/Label.java +++ b/core/src/main/java/io/kestra/core/models/Label.java @@ -18,6 +18,7 @@ public record Label(@NotNull String key, @NotNull String value) { public static final String RESTARTED = SYSTEM_PREFIX + "restarted"; public static final String REPLAY = SYSTEM_PREFIX + "replay"; public static final String REPLAYED = SYSTEM_PREFIX + "replayed"; + public static final String TEST = SYSTEM_PREFIX + "test"; /** * Static helper method for converting a list of labels to a nested map. diff --git a/core/src/main/java/io/kestra/core/models/executions/Execution.java b/core/src/main/java/io/kestra/core/models/executions/Execution.java index 4696b28f3fe..af8d2c8ef58 100644 --- a/core/src/main/java/io/kestra/core/models/executions/Execution.java +++ b/core/src/main/java/io/kestra/core/models/executions/Execution.java @@ -21,7 +21,9 @@ import io.kestra.core.serializers.ListOrMapOfLabelDeserializer; import io.kestra.core.serializers.ListOrMapOfLabelSerializer; import io.kestra.core.services.LabelService; +import io.kestra.core.test.Fixture; import io.kestra.core.utils.IdUtils; +import io.kestra.core.utils.ListUtils; import io.kestra.core.utils.MapUtils; import io.micronaut.core.annotation.Nullable; import io.swagger.v3.oas.annotations.Hidden; @@ -111,6 +113,10 @@ public class Execution implements DeletedInterface, TenantInterface { @Setter String traceParent; + @With + @Nullable + List fixtures; + /** * Factory method for constructing a new {@link Execution} object for the given {@link Flow}. * @@ -205,7 +211,8 @@ public Execution withState(State.Type state) { this.deleted, this.metadata, this.scheduleDate, - this.traceParent + this.traceParent, + this.fixtures ); } @@ -229,7 +236,8 @@ public Execution withLabels(List