mirror of
https://github.com/kestra-io/kestra.git
synced 2025-12-19 18:05:41 -05:00
feat(tests): add test coverage for subflow inputs serialized with type yaml
This commit is contained in:
committed by
Loïc Mathieu
parent
e821bd7f65
commit
2595e56199
@@ -16,6 +16,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
@@ -64,6 +65,26 @@ class SubflowRunnerTest {
|
||||
new Label("parentFlowLabel2", "value2") // inherited from the parent flow
|
||||
);
|
||||
}
|
||||
@Test
|
||||
@LoadFlows({"flows/valids/subflow-serialized-yml-input-child.yaml", "flows/valids/subflow-serialized-yml-input-parent.yaml"})
|
||||
void subflowInputTypeYmlSerialization() throws QueueException, TimeoutException {
|
||||
Execution parentExecution = runnerUtils.runOne(MAIN_TENANT, "io.kestra.tests", "subflow-serialized-yml-input-parent");
|
||||
String childExecutionId = (String) parentExecution.findTaskRunsByTaskId("hello1").getFirst().getOutputs().get("executionId");
|
||||
|
||||
assertThat(childExecutionId).isNotBlank();
|
||||
|
||||
Execution childExecution = executionRepository.findById(MAIN_TENANT, childExecutionId).orElseThrow();
|
||||
|
||||
assertThat(childExecution.getTaskRunList()).hasSize(2);
|
||||
|
||||
Map<?,?>outputs1= (Map<?,?>) childExecution.outputs().get("hello2");
|
||||
assertThat( outputs1.get("value"))
|
||||
.isEqualTo("[{\"name1\":[{\"first1\":\"Mustafa\"},{\"last1\":\"Tarek\"}]},{\"name2\":[{\"first2\":\"Ahmed\"},{\"last2\":\"Tarek\"}]}]");
|
||||
|
||||
Map<?,?>outputs2= (Map<?,?>) childExecution.outputs().get("hello3");
|
||||
assertThat(outputs2.get("value")).isEqualTo("dummy");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@LoadFlows({"flows/valids/subflow-parent-no-wait.yaml", "flows/valids/subflow-child-with-output.yaml"})
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
id: subflow-serialized-yml-input-child
|
||||
namespace: io.kestra.tests
|
||||
|
||||
inputs:
|
||||
- id: people
|
||||
type: YAML
|
||||
- id: basic
|
||||
type: YAML
|
||||
|
||||
tasks:
|
||||
- id: hello2
|
||||
type: io.kestra.plugin.core.debug.Return
|
||||
format: "{{ inputs.people }}"
|
||||
- id: hello3
|
||||
type: io.kestra.plugin.core.debug.Return
|
||||
format: "{{ inputs.basic }}"
|
||||
@@ -0,0 +1,17 @@
|
||||
id: subflow-serialized-yml-input-parent
|
||||
namespace: io.kestra.tests
|
||||
|
||||
tasks:
|
||||
- id: hello1
|
||||
type: io.kestra.plugin.core.flow.Subflow
|
||||
namespace: io.kestra.tests
|
||||
flowId: subflow-serialized-yml-input-child
|
||||
inputs:
|
||||
people:
|
||||
- name1:
|
||||
- first1: "Mustafa"
|
||||
- last1: "Tarek"
|
||||
- name2:
|
||||
- first2: "Ahmed"
|
||||
- last2: "Tarek"
|
||||
basic: dummy
|
||||
Reference in New Issue
Block a user