use of io.kestra.core.models.executions.Execution in project kestra by kestra-io.
the class KafkaElasticIndexerTest method buildExecutionRecord.
private ConsumerRecord<String, String> buildExecutionRecord(String topic, int offset) throws JsonProcessingException {
Flow flow = TestsUtils.mockFlow();
Execution execution = TestsUtils.mockExecution(flow, ImmutableMap.of());
return buildRecord(topic, execution.getId(), JacksonMapper.ofJson().writeValueAsString(execution), offset);
}
use of io.kestra.core.models.executions.Execution in project kestra by kestra-io.
the class ConditionServiceTest method valid.
@Test
void valid() {
Flow flow = TestsUtils.mockFlow();
Execution execution = TestsUtils.mockExecution(flow, ImmutableMap.of());
RunContext runContext = runContextFactory.of(flow, execution);
ConditionContext conditionContext = conditionService.conditionContext(runContext, flow, execution);
List<Condition> conditions = Arrays.asList(ExecutionFlowCondition.builder().namespace(flow.getNamespace()).flowId(flow.getId()).build(), ExecutionNamespaceCondition.builder().namespace(flow.getNamespace()).build());
boolean valid = conditionService.valid(flow, conditions, conditionContext);
assertThat(valid, is(true));
}
use of io.kestra.core.models.executions.Execution in project kestra by kestra-io.
the class BashTest method error.
@Test
void error() throws TimeoutException {
Execution execution = runnerUtils.runOne("io.kestra.tests", "bash-warning");
assertThat(execution.getState().getCurrent(), is(State.Type.WARNING));
assertThat(execution.getTaskRunList().get(0).getState().getCurrent(), is(State.Type.WARNING));
assertThat(execution.getTaskRunList().get(0).getOutputs().get("stdErrLineCount"), is(1));
assertThat(execution.getTaskRunList(), hasSize(1));
}
use of io.kestra.core.models.executions.Execution in project kestra by kestra-io.
the class AllowFailureTest method success.
@Test
void success() throws TimeoutException {
Execution execution = runnerUtils.runOne("io.kestra.tests", "allow-failure", Duration.ofSeconds(120));
assertThat(execution.getTaskRunList(), hasSize(9));
control(execution);
assertThat(execution.findTaskRunsByTaskId("global-error").size(), is(0));
assertThat(execution.findTaskRunsByTaskId("last").get(0).getState().getCurrent(), is(State.Type.SUCCESS));
assertThat(execution.getState().getCurrent(), is(State.Type.WARNING));
}
use of io.kestra.core.models.executions.Execution in project kestra by kestra-io.
the class AllowFailureTest method failed.
@Test
void failed() throws TimeoutException {
Execution execution = runnerUtils.runOne("io.kestra.tests", "allow-failure", null, (f, e) -> runnerUtils.typedInputs(f, e, ImmutableMap.of("crash", "1")));
assertThat(execution.getTaskRunList(), hasSize(10));
control(execution);
assertThat(execution.findTaskRunsByTaskId("global-error").get(0).getState().getCurrent(), is(State.Type.SUCCESS));
assertThat(execution.findTaskRunsByTaskId("switch").get(0).getState().getCurrent(), is(State.Type.FAILED));
assertThat(execution.findTaskRunsByTaskId("crash").get(0).getState().getCurrent(), is(State.Type.FAILED));
assertThat(execution.getState().getCurrent(), is(State.Type.FAILED));
}
Aggregations