Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void should_create_output_csv() throws Exception {
var goScript = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/go_script.go"),
new URI("/file/storage/csv_output/go_script.go"),
IOUtils.toInputStream("""
package main
import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void task() throws Exception {
URI put = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new URI("/file/storage/tests/scripts/julia/get.yml"),
IOUtils.toInputStream(
"@info \"hello there!\";",
StandardCharsets.UTF_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void task() throws Exception {
URI put = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new URI("/file/storage/tests/scripts/node/get.yml"),
IOUtils.toInputStream(
"console.log('hello there!');",
StandardCharsets.UTF_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void task() throws Exception {
var phpScript = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new URI("/file/storage/tests/scripts/php/get.yml"),
IOUtils.toInputStream(
"""
#!/usr/bin/php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void task() throws Exception {
URI put = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new URI("/file/storage/tests/scripts/powershell/get.yml"),
IOUtils.toInputStream(
"Get-ChildItem | Format-List",
StandardCharsets.UTF_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void task() throws Exception {
URI put = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new URI("/file/storage/tests/scripts/python/get.yml"),
IOUtils.toInputStream(
"print('hello there!')",
StandardCharsets.UTF_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void inputs(RunnerType runner, DockerOptions dockerOptions) throws Exception {
URI put = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new URI("/file/storage/tests/scripts/get.yml"),
IOUtils.toInputStream(
"hello there!",
StandardCharsets.UTF_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void task() throws Exception {
URI put = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new URI("/file/storage/tests/scripts/r/get.yml"),
IOUtils.toInputStream(
"aString = \"Hello World!\"\n" +
"print (aString)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void task() throws Exception {
URI put = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new URI("/file/storage/tests/scripts/ruby/get.yml"),
IOUtils.toInputStream(
"puts \"Hello World!\"\n" +
"STDERR.puts \"done\"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,7 @@ void useInputFiles() throws Exception {
void useInputFilesFromKestraFs() throws Exception {
URL resource = AbstractBashTest.class.getClassLoader().getResource("application.yml");

URI put = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new FileInputStream(Objects.requireNonNull(resource).getFile())
);
URI put = putUnique(storageInterface, resource);

Map<String, String> files = new HashMap<>();
files.put("test.sh", "cat fscontent.txt");
Expand Down Expand Up @@ -204,19 +199,9 @@ void useInputFilesFromKestraFs() throws Exception {
void useInputFilesAsVariable() throws Exception {
URL resource = AbstractBashTest.class.getClassLoader().getResource("application.yml");

URI put1 = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new FileInputStream(Objects.requireNonNull(resource).getFile())
);
URI put1 = putUnique(storageInterface, resource);

URI put2 = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new FileInputStream(Objects.requireNonNull(resource).getFile())
);
URI put2 = putUnique(storageInterface, resource);

Map<String, String> files = new HashMap<>();
files.put("1.yml", put1.toString());
Expand Down Expand Up @@ -246,12 +231,7 @@ void useInputFilesAsVariable() throws Exception {
void preventRelativeFile() throws Exception {
URL resource = AbstractBashTest.class.getClassLoader().getResource("application.yml");

URI put = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new FileInputStream(Objects.requireNonNull(resource).getFile())
);
URI put = putUnique(storageInterface, resource);

assertThrows(IllegalArgumentException.class, () -> {
Bash bash = configure(Bash.builder()
Expand Down Expand Up @@ -331,4 +311,14 @@ static <T> AbstractMetricEntry<T> getMetrics(RunContext runContext, String name)
.findFirst()
.orElseThrow();
}

private static URI putUnique(StorageInterface storage, URL resource) throws Exception {
String name = "test-" + UUID.randomUUID() + ".yml";
return storage.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/tests/" + name),
new FileInputStream(Objects.requireNonNull(resource).getFile())
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void files(RunnerType runner, DockerOptions dockerOptions) throws Exception {
URI put = storageInterface.put(
TenantService.MAIN_TENANT,
null,
new URI("/file/storage/get.yml"),
new URI("/file/storage/tests/scripts/shell/get.yml"),
IOUtils.toInputStream("I'm here", StandardCharsets.UTF_8)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected io.kestra.core.tasks.scripts.ScriptOutput run(RunContext runContext, S
if (!rFiles.isEmpty()) {
allOutputs.addAll(rFiles);
}

Map<String, String> outputFilePaths = PluginUtilsService.createOutputFiles(
workingDirectory,
allOutputs,
Expand Down
Loading