Skip to content

Commit 75b5cd4

Browse files
committed
test(shell): add outputFilesPebbleExpression test
Locks in the contract that {{ outputFiles.name }} resolves to the correct absolute path inside a Script body, as fixed in kestra-io/kestra#13765. Requires a kestraVersion bump to pick up the core fix before this test can pass in CI.
1 parent d40a9af commit 75b5cd4

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

  • plugin-script-shell/src/test/java/io/kestra/plugin/scripts/shell

plugin-script-shell/src/test/java/io/kestra/plugin/scripts/shell/ScriptTest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,29 @@ void inputOutputFiles() throws Exception {
177177
);
178178
}
179179

180+
@Test
181+
void outputFilesPebbleExpression() throws Exception {
182+
// Verifies that {{ outputFiles.outfile }} resolves to the correct absolute path inside the script body.
183+
// This is the fix for https://github.com/kestra-io/kestra/issues/13765.
184+
// Use Property.ofExpression to simulate YAML deserialization (value=null → Pebble rendering runs).
185+
Script bash = Script.builder()
186+
.id("shell-output-files-pebble-" + UUID.randomUUID())
187+
.type(Script.class.getName())
188+
.outputFiles(Property.ofValue(List.of("outfile")))
189+
.script(Property.ofExpression("echo -n {{ outputFiles.outfile }} > outfile"))
190+
.build();
191+
192+
RunContext runContext = TestsUtils.mockRunContext(runContextFactory, bash, ImmutableMap.of());
193+
ScriptOutput run = bash.run(runContext);
194+
195+
assertThat(run.getExitCode(), is(0));
196+
assertThat(run.getOutputFiles().get("outfile").toString(), startsWith("kestra://"));
197+
assertThat(
198+
new String(storageInterface.get(TenantService.MAIN_TENANT, null, run.getOutputFiles().get("outfile")).readAllBytes()),
199+
endsWith("/outfile")
200+
);
201+
}
202+
180203
private URI internalFiles(String path) throws IOException, URISyntaxException {
181204
var resource = ScriptTest.class.getClassLoader().getResource("application.yml");
182205

0 commit comments

Comments
 (0)