use of io.kestra.core.models.executions.LogEntry in project kestra by kestra-io.
the class ConditionServiceTest method exception.
@Test
void exception() throws InterruptedException {
List<LogEntry> logs = new ArrayList<>();
logQueue.receive(logs::add);
Flow flow = TestsUtils.mockFlow();
Schedule schedule = Schedule.builder().id("unit").type(Schedule.class.getName()).cron("0 0 1 * *").build();
RunContext runContext = runContextFactory.of(flow, schedule);
ConditionContext conditionContext = conditionService.conditionContext(runContext, flow, null);
List<Condition> conditions = Collections.singletonList(ExecutionFlowCondition.builder().namespace(flow.getNamespace()).flowId(flow.getId()).build());
conditionService.valid(flow, conditions, conditionContext);
Thread.sleep(250);
assertThat(logs.stream().filter(logEntry -> logEntry.getNamespace().equals("io.kestra.core.services.ConditionServiceTest")).count(), greaterThan(0L));
assertThat(logs.stream().filter(logEntry -> logEntry.getFlowId().equals("exception")).count(), greaterThan(0L));
}
use of io.kestra.core.models.executions.LogEntry in project kestra by kestra-io.
the class VariablesTest method invalidVars.
@Test
void invalidVars() throws TimeoutException {
List<LogEntry> logs = new ArrayList<>();
workerTaskLogQueue.receive(logs::add);
Execution execution = runnerUtils.runOne("io.kestra.tests", "variables-invalid");
List<LogEntry> filters = TestsUtils.filterLogs(logs, execution.getTaskRunList().get(1));
assertThat(execution.getTaskRunList(), hasSize(2));
assertThat(execution.getTaskRunList().get(1).getState().getCurrent(), is(State.Type.FAILED));
assertThat(filters.stream().filter(logEntry -> logEntry.getMessage().contains("Missing variable: 'inputs' on '{{inputs.invalid}}'")).count(), greaterThan(0L));
assertThat(execution.getState().getCurrent(), is(State.Type.FAILED));
}
use of io.kestra.core.models.executions.LogEntry in project kestra by kestra-io.
the class RunContextTest method inputsLarge.
@Test
void inputsLarge() throws TimeoutException, InterruptedException {
List<LogEntry> logs = new ArrayList<>();
workerTaskLogQueue.receive(logs::add);
char[] chars = new char[1024 * 11];
Arrays.fill(chars, 'a');
Map<String, String> inputs = new HashMap<>(InputsTest.inputs);
inputs.put("string", new String(chars));
Execution execution = runnerUtils.runOne("io.kestra.tests", "inputs-large", null, (flow, execution1) -> runnerUtils.typedInputs(flow, execution1, inputs));
assertThat(execution.getTaskRunList(), hasSize(10));
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS));
assertThat(execution.getTaskRunList().get(0).getState().getCurrent(), is(State.Type.SUCCESS));
List<LogEntry> logEntries = logs.stream().filter(logEntry -> logEntry.getTaskRunId() != null && logEntry.getTaskRunId().equals(execution.getTaskRunList().get(1).getId())).sorted(Comparator.comparingLong(value -> value.getTimestamp().toEpochMilli())).collect(Collectors.toList());
Thread.sleep(100);
assertThat(logEntries.get(0).getTimestamp().toEpochMilli() + 1, is(logEntries.get(1).getTimestamp().toEpochMilli()));
}
use of io.kestra.core.models.executions.LogEntry in project kestra by kestra-io.
the class KafkaRunnerTest method invalidVars.
@Test
void invalidVars() throws TimeoutException {
List<LogEntry> logs = new ArrayList<>();
logsQueue.receive(logs::add);
Execution execution = runnerUtils.runOne("io.kestra.tests", "variables-invalid", null, null, Duration.ofSeconds(60));
List<LogEntry> filters = TestsUtils.filterLogs(logs, execution.getTaskRunList().get(1));
assertThat(execution.getTaskRunList(), hasSize(2));
assertThat(execution.getTaskRunList().get(1).getState().getCurrent(), is(State.Type.FAILED));
assertThat(filters.stream().filter(logEntry -> logEntry.getMessage().contains("Missing variable: 'inputs' on '{{inputs.invalid}}'")).count(), greaterThan(0L));
assertThat(execution.getState().getCurrent(), is(State.Type.FAILED));
}
use of io.kestra.core.models.executions.LogEntry in project kestra by kestra-io.
the class KafkaRunnerTest method streamTooLarge.
@Test
void streamTooLarge() throws TimeoutException {
List<LogEntry> logs = new ArrayList<>();
logsQueue.receive(logs::add);
char[] chars = new char[1100000];
Arrays.fill(chars, 'a');
Map<String, String> inputs = new HashMap<>(InputsTest.inputs);
inputs.put("string", new String(chars));
Execution execution = runnerUtils.runOne("io.kestra.tests", "inputs-large", null, (flow, execution1) -> runnerUtils.typedInputs(flow, execution1, inputs), Duration.ofSeconds(120));
assertThat(execution.getTaskRunList(), hasSize(10));
assertThat(execution.getState().getCurrent(), is(State.Type.FAILED));
assertThat(execution.getTaskRunList().get(0).getState().getCurrent(), is(State.Type.FAILED));
assertThat(logs.stream().filter(logEntry -> logEntry.getMessage().contains("max.request.size")).count(), greaterThan(0L));
}
Aggregations