use of io.kestra.core.runners.RunContext in project kestra by kestra-io.
the class AbstractBashTest method longBashCreateTempFiles.
@Test
void longBashCreateTempFiles() throws Exception {
List<String> commands = new ArrayList<>();
for (int i = 0; i < 15000; i++) {
commands.add("if [ \"" + i + "\" -eq 0 ] || [ \"" + i + "\" -eq 14999 ]; then echo " + i + ";fi;");
}
Bash bash = configure(Bash.builder().commands(commands.toArray(String[]::new))).build();
RunContext runContext = TestsUtils.mockRunContext(runContextFactory, bash, ImmutableMap.of());
ScriptOutput run = bash.run(runContext);
assertThat(run.getExitCode(), is(0));
assertThat(run.getStdOutLineCount(), is(2));
assertThat(run.getStdErrLineCount() > 0, is(false));
}
use of io.kestra.core.runners.RunContext in project kestra by kestra-io.
the class DeleteTest method run.
@Test
void run() throws Exception {
RunContext runContext = runContextFactory.of();
URL resource = DeleteTest.class.getClassLoader().getResource("application.yml");
URI put = storageInterface.put(new URI("/file/storage/get.yml"), new FileInputStream(Objects.requireNonNull(resource).getFile()));
Delete bash = Delete.builder().uri(put.toString()).build();
Delete.Output run = bash.run(runContext);
assertThat(run.getDeleted(), is(true));
run = bash.run(runContext);
assertThat(run.getDeleted(), is(false));
assertThrows(NoSuchElementException.class, () -> {
Delete error = Delete.builder().uri(put.toString()).errorOnMissing(true).build();
error.run(runContext);
});
}
Aggregations