diff --git a/plugin-script-go/src/test/java/io/kestra/plugins/scripts/go/CommandsTest.java b/plugin-script-go/src/test/java/io/kestra/plugins/scripts/go/CommandsTest.java index f42fd905..01ea8c4b 100644 --- a/plugin-script-go/src/test/java/io/kestra/plugins/scripts/go/CommandsTest.java +++ b/plugin-script-go/src/test/java/io/kestra/plugins/scripts/go/CommandsTest.java @@ -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 ( diff --git a/plugin-script-julia/src/test/java/io/kestra/plugin/scripts/julia/CommandsTest.java b/plugin-script-julia/src/test/java/io/kestra/plugin/scripts/julia/CommandsTest.java index a5bade5f..2f9c1c75 100644 --- a/plugin-script-julia/src/test/java/io/kestra/plugin/scripts/julia/CommandsTest.java +++ b/plugin-script-julia/src/test/java/io/kestra/plugin/scripts/julia/CommandsTest.java @@ -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 diff --git a/plugin-script-node/src/test/java/io/kestra/plugin/scripts/node/CommandsTest.java b/plugin-script-node/src/test/java/io/kestra/plugin/scripts/node/CommandsTest.java index ad010094..4c4cfbae 100644 --- a/plugin-script-node/src/test/java/io/kestra/plugin/scripts/node/CommandsTest.java +++ b/plugin-script-node/src/test/java/io/kestra/plugin/scripts/node/CommandsTest.java @@ -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 diff --git a/plugin-script-php/src/test/java/io/kestra/plugin/scripts/php/CommandsTest.java b/plugin-script-php/src/test/java/io/kestra/plugin/scripts/php/CommandsTest.java index 7a04efed..3c5dc65b 100644 --- a/plugin-script-php/src/test/java/io/kestra/plugin/scripts/php/CommandsTest.java +++ b/plugin-script-php/src/test/java/io/kestra/plugin/scripts/php/CommandsTest.java @@ -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 diff --git a/plugin-script-powershell/src/test/java/io/kestra/plugin/scripts/powershell/CommandsTest.java b/plugin-script-powershell/src/test/java/io/kestra/plugin/scripts/powershell/CommandsTest.java index e00a01d9..ed8641fd 100644 --- a/plugin-script-powershell/src/test/java/io/kestra/plugin/scripts/powershell/CommandsTest.java +++ b/plugin-script-powershell/src/test/java/io/kestra/plugin/scripts/powershell/CommandsTest.java @@ -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 diff --git a/plugin-script-python/src/test/java/io/kestra/plugin/scripts/python/CommandsTest.java b/plugin-script-python/src/test/java/io/kestra/plugin/scripts/python/CommandsTest.java index 16644507..7f2e1de3 100644 --- a/plugin-script-python/src/test/java/io/kestra/plugin/scripts/python/CommandsTest.java +++ b/plugin-script-python/src/test/java/io/kestra/plugin/scripts/python/CommandsTest.java @@ -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 diff --git a/plugin-script-python/src/test/java/io/kestra/plugin/scripts/python/ScriptTest.java b/plugin-script-python/src/test/java/io/kestra/plugin/scripts/python/ScriptTest.java index 85766069..beb5a89f 100644 --- a/plugin-script-python/src/test/java/io/kestra/plugin/scripts/python/ScriptTest.java +++ b/plugin-script-python/src/test/java/io/kestra/plugin/scripts/python/ScriptTest.java @@ -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 diff --git a/plugin-script-r/src/test/java/io/kestra/plugin/scripts/r/CommandsTest.java b/plugin-script-r/src/test/java/io/kestra/plugin/scripts/r/CommandsTest.java index 32048b98..89242a21 100644 --- a/plugin-script-r/src/test/java/io/kestra/plugin/scripts/r/CommandsTest.java +++ b/plugin-script-r/src/test/java/io/kestra/plugin/scripts/r/CommandsTest.java @@ -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)", diff --git a/plugin-script-ruby/src/test/java/io/kestra/plugin/scripts/ruby/CommandsTest.java b/plugin-script-ruby/src/test/java/io/kestra/plugin/scripts/ruby/CommandsTest.java index 03594fb7..8bc107e8 100644 --- a/plugin-script-ruby/src/test/java/io/kestra/plugin/scripts/ruby/CommandsTest.java +++ b/plugin-script-ruby/src/test/java/io/kestra/plugin/scripts/ruby/CommandsTest.java @@ -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\"", diff --git a/plugin-script-shell/src/test/java/io/kestra/core/tasks/scripts/AbstractBashTest.java b/plugin-script-shell/src/test/java/io/kestra/core/tasks/scripts/AbstractBashTest.java index 3c53e89f..9cf73bb6 100644 --- a/plugin-script-shell/src/test/java/io/kestra/core/tasks/scripts/AbstractBashTest.java +++ b/plugin-script-shell/src/test/java/io/kestra/core/tasks/scripts/AbstractBashTest.java @@ -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 files = new HashMap<>(); files.put("test.sh", "cat fscontent.txt"); @@ -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 files = new HashMap<>(); files.put("1.yml", put1.toString()); @@ -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() @@ -331,4 +311,14 @@ static AbstractMetricEntry 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()) + ); + } } diff --git a/plugin-script-shell/src/test/java/io/kestra/plugin/scripts/shell/CommandsTest.java b/plugin-script-shell/src/test/java/io/kestra/plugin/scripts/shell/CommandsTest.java index 6c9c325d..81e18df8 100644 --- a/plugin-script-shell/src/test/java/io/kestra/plugin/scripts/shell/CommandsTest.java +++ b/plugin-script-shell/src/test/java/io/kestra/plugin/scripts/shell/CommandsTest.java @@ -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) ); diff --git a/plugin-script/src/main/java/io/kestra/core/tasks/scripts/AbstractBash.java b/plugin-script/src/main/java/io/kestra/core/tasks/scripts/AbstractBash.java index 0590639e..512c1acb 100644 --- a/plugin-script/src/main/java/io/kestra/core/tasks/scripts/AbstractBash.java +++ b/plugin-script/src/main/java/io/kestra/core/tasks/scripts/AbstractBash.java @@ -189,7 +189,7 @@ protected io.kestra.core.tasks.scripts.ScriptOutput run(RunContext runContext, S if (!rFiles.isEmpty()) { allOutputs.addAll(rFiles); } - + Map outputFilePaths = PluginUtilsService.createOutputFiles( workingDirectory, allOutputs,