Skip to content

Commit 94d9372

Browse files
committed
Add touch and cat
1 parent d35dc8f commit 94d9372

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

impl/test/src/test/java/io/serverlessworkflow/impl/test/shell/RunTaskExecutorTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ void testEchoWithEnvironment() throws IOException {
8181
}
8282
}
8383

84+
@Test
85+
void testTouchAndCat() throws IOException {
86+
Workflow workflow =
87+
WorkflowReader.readWorkflowFromClasspath(
88+
"workflows-samples/shell-process/touch-cat.yaml");
89+
try (WorkflowApplication appl = WorkflowApplication.builder().build()) {
90+
WorkflowModel model =
91+
appl.workflowDefinition(workflow).instance(Map.of("lastName", "Doe")).start().join();
92+
SoftAssertions.assertSoftly(
93+
softly -> {
94+
ProcessResult result = model.as(ProcessResult.class).orElseThrow();
95+
softly.assertThat(result.code()).isEqualTo(0);
96+
softly.assertThat(result.stderr()).isEmpty();
97+
softly.assertThat(result.stdout()).contains("hello world");
98+
});
99+
}
100+
}
101+
84102
record Input(User user) {}
85103

86104
record User(String name) {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
document:
2+
dsl: '1.0.1'
3+
namespace: test
4+
name: run-shell-example
5+
version: '0.1.0'
6+
do:
7+
- runShell:
8+
run:
9+
shell:
10+
# write hello world to a file and then cat it
11+
command: echo "hello world" > /tmp/hello.txt && cat /tmp/hello.txt
12+
environment:
13+
FIRST_NAME: John
14+
LAST_NAME: ${.lastName}
15+

0 commit comments

Comments
 (0)