Skip to content

Commit fdf9ec7

Browse files
committed
[Fix_#856] Add debug task
Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
1 parent 2d79abe commit fdf9ec7

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed

ctk/features/debug.feature

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Feature: Debug Task
2+
As an implementer of the workflow DSL
3+
I want to ensure that debug tasks can be executed within the workflow
4+
So that my implementation conforms to the expected behaviour
5+
6+
# Tests Debug with literal constant
7+
Scenario: Debug with literal constant
8+
Given a workflow with definition:
9+
"""yaml
10+
document:
11+
dsl: 1.0.0-alpha1
12+
namespace: default
13+
name: debug
14+
do:
15+
printMessage:
16+
debug: Hello world!
17+
"""
18+
And given the workflow input is:
19+
"""yaml
20+
"""
21+
When the workflow is executed
22+
Then the workflow should complete
23+
24+
# Tests Debug with expression
25+
Scenario: Debug with expression
26+
Given a workflow with definition:
27+
"""yaml
28+
document:
29+
dsl: 1.0.0-alpha1
30+
namespace: default
31+
name: debug
32+
do:
33+
printMessage:
34+
debug: ${Hello \(.name)!}
35+
"""
36+
And given the workflow input is:
37+
"""yaml
38+
name: John
39+
"""
40+
When the workflow is executed
41+
Then the workflow should complete
42+

dsl-reference.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- [Set](#set)
2929
- [Try](#try)
3030
- [Wait](#wait)
31+
- [Debug](#debug)
3132
+ [Flow Directive](#flow-directive)
3233
+ [External Resource](#external-resource)
3334
+ [Authentication](#authentication)
@@ -973,6 +974,22 @@ do:
973974
seconds: 10
974975
```
975976

977+
#### Debug
978+
979+
Allows workflows to print information to standart output. It accepts a string that can be a literal or an expr
980+
981+
##### Examples
982+
```yaml
983+
document:
984+
dsl: '1.0.0-alpha1'
985+
namespace: test
986+
name: sample-workflow
987+
version: '0.1.0'
988+
do:
989+
printMessage:
990+
debug: Hello world!
991+
```
992+
976993
### Flow Directive
977994

978995
Flow Directives are commands within a workflow that dictate its progression.

dsl.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ The Serverless Workflow DSL defines several default [task](dsl-reference.md#task
111111
- [Set](dsl-reference.md#set), used to dynamically set or update the [workflow](dsl-reference.md#workflow)'s data during the its execution.
112112
- [Try](dsl-reference.md#try), used to attempt executing a specified [task](dsl-reference.md#task), and to handle any resulting [errors](dsl-reference.md#error) gracefully, allowing the [workflow](dsl-reference.md#workflow) to continue without interruption.
113113
- [Wait](dsl-reference.md#wait), used to pause or wait for a specified duration before proceeding to the next task.
114+
- [Debug] (dsl-reference.md#debug), used to print information to standard output
114115

115-
To ensure they conform to the DSL, runtimes **should** pass all the feature conformance test scenarii defined in the [ctk](ctk/README.md).
116+
To ensure they conform to the DSL, runtimes **should** pass all the feature conformance test scenario defined in the [ctk](ctk/README.md).
116117

117118
##### Secret
118119

schema/workflow.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ $defs:
127127
- $ref: '#/$defs/switchTask'
128128
- $ref: '#/$defs/tryTask'
129129
- $ref: '#/$defs/waitTask'
130+
- $ref: '#/$defs/debugTask'
130131
callTask:
131132
type: object
132133
oneOf:
@@ -533,6 +534,12 @@ $defs:
533534
description: The amount of time to wait.
534535
required: [ wait ]
535536
description: Allows workflows to pause or delay their execution for a specified period of time.
537+
debugTask:
538+
type: object
539+
properties:
540+
debug:
541+
type: string
542+
description: Print a message (a literal string or an expression) to standard output
536543
authenticationPolicy:
537544
type: object
538545
oneOf:

0 commit comments

Comments
 (0)