Skip to content

Commit

Permalink
fix(core-ee): avoid the need of recursiveness when generating outputF…
Browse files Browse the repository at this point in the history
…iles
  • Loading branch information
brian-mulier-p committed Jan 18, 2024
1 parent 381869b commit 7584998
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static Map<String, String> createOutputFiles(
tempFile = File.createTempFile(s + "_", null, tempDirectory.toFile());
}

result.put(s, "{{workingDir}}/" + tempFile.getName());
result.put(s, additionalVars.get("workingDir") + "/" + tempFile.getName());
}));

if (!isDir) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.kestra.core.tasks;

import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.startsWith;

public class PluginUtilsServiceTest {
@Test
void outputFiles() throws IOException {
Path tempDirectory = Files.createTempDirectory("plugin-utils");
Map<String, String> outputFilesMap = PluginUtilsService.createOutputFiles(
tempDirectory,
List.of("out"),
new HashMap<>(Map.of("workingDir", tempDirectory.toAbsolutePath().toString()))
);

assertThat(outputFilesMap.get("out"), startsWith(tempDirectory.resolve("out_").toString()));
}
}

0 comments on commit 7584998

Please sign in to comment.