diff --git a/examples/fail.yaml b/examples/fail.yaml new file mode 100644 index 0000000..4e77499 --- /dev/null +++ b/examples/fail.yaml @@ -0,0 +1,7 @@ +--- +phases: +- name: main + tasks: + - name: fail + command: + command: "false" diff --git a/examples/main_test.go b/examples/main_test.go index 40eabb8..5a1f4f6 100644 --- a/examples/main_test.go +++ b/examples/main_test.go @@ -15,25 +15,31 @@ func TestBuildflow(t *testing.T) { { title: "hello world", file: "hello_world.yaml", - exp: icmd.Expected{ - ExitCode: 0, - Err: "", - }, }, { title: "run tasks in parallel", file: "parallel.yaml", - exp: icmd.Expected{ - ExitCode: 0, - Err: "", - }, }, { title: "the task bar depends on the task foo", file: "task_dependency.yaml", + }, + { + title: "task.when is true", + file: "task_when_true.yaml", + }, + { + title: "buildflow run fails as expected", + file: "fail.yaml", + exp: icmd.Expected{ + ExitCode: 1, + }, + }, + { + title: "if there are unknown fields in configuration file, buildflow run fails", + file: "unknown_field.yaml", exp: icmd.Expected{ - ExitCode: 0, - Err: "", + ExitCode: 1, }, }, } diff --git a/examples/task_when_true.yaml b/examples/task_when_true.yaml new file mode 100644 index 0000000..a62bcb4 --- /dev/null +++ b/examples/task_when_true.yaml @@ -0,0 +1,8 @@ +--- +phases: +- name: main + tasks: + - name: "when true" + command: + command: ":" + when: true diff --git a/examples/unknown_field.yaml b/examples/unknown_field.yaml new file mode 100644 index 0000000..acf7e42 --- /dev/null +++ b/examples/unknown_field.yaml @@ -0,0 +1,7 @@ +--- +phases: +- name: main + tsks: # typo + - name: hello + command: + command: echo hello