Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,7 @@ func TestFailfast(t *testing.T) {
t.Parallel()

NewExecutorTest(t,
WithVar("PUSH", "5"),
WithName("default"),
WithExecutorOptions(
task.WithDir("testdata/failfast/default"),
Expand Down
1 change: 1 addition & 0 deletions testdata/failfast/default/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.txt
32 changes: 24 additions & 8 deletions testdata/failfast/default/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,29 @@ version: '3'

tasks:
default:
cmds:
- rm -f *.txt
- task: test
vars:
PUSH: '{{.PUSH | default 0.1}}' # Push the deps1-3 out beyond the failfast event.

test:
deps:
- dep1
- dep2
- dep3
- dep4
- task: dep1
vars: { PUSH: '{{.PUSH}}' }
- task: dep2
vars: { PUSH: '{{.PUSH}}' }
- task: dep3
vars: { PUSH: '{{.PUSH}}' }
- task: dep4

dep1: sleep 0.1 && echo 'dep1'
dep2: sleep 0.2 && echo 'dep2'
dep3: sleep 0.3 && echo 'dep3'
dep4: exit 1
# Deps1-3 wait for Dep4 before starting.
dep1: touch dep1.txt; until [ -f dep4.txt ]; do sleep 0.1; done; sleep {{.PUSH}}; printf "dep1\n"
dep2: touch dep2.txt; until [ -f dep4.txt ]; do sleep 0.1; done; sleep {{.PUSH}}; printf "dep2\n"
dep3: touch dep3.txt; until [ -f dep4.txt ]; do sleep 0.1; done; sleep {{.PUSH}}; printf "dep3\n"
# Dep4 waits from Dep1-3 and then indicates that it has started.
dep4:
cmds:
- until [ -f dep1.txt ] && [ -f dep2.txt ] && [ -f dep3.txt ]; do sleep 0.1; done
- touch dep4.txt
- exit 1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
task: Failed to run task "default": task: Failed to run task "dep4": exit status 1
task: Failed to run task "default": task: Failed to run task "test": task: Failed to run task "dep4": exit status 1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
task: Failed to run task "default": task: Failed to run task "dep4": exit status 1
task: Failed to run task "default": task: Failed to run task "test": task: Failed to run task "dep4": exit status 1
1 change: 1 addition & 0 deletions testdata/failfast/task/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.txt
22 changes: 18 additions & 4 deletions testdata/failfast/task/Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
version: '3'

vars:
PUSH: 5 # Push the deps1-3 out beyond the failfast event.

tasks:
default:
cmds:
- rm -f *.txt
- task: test

test:
deps:
- dep1
- dep2
- dep3
- dep4
failfast: true

dep1: sleep 0.1 && echo 'dep1'
dep2: sleep 0.2 && echo 'dep2'
dep3: sleep 0.3 && echo 'dep3'
dep4: exit 1
# Deps1-3 wait for Dep4 before starting.
dep1: touch dep1.txt; until [ -f dep4.txt ]; do sleep 0.1; done; sleep {{.PUSH}}; printf "dep1\n"
dep2: touch dep2.txt; until [ -f dep4.txt ]; do sleep 0.1; done; sleep {{.PUSH}}; printf "dep2\n"
dep3: touch dep3.txt; until [ -f dep4.txt ]; do sleep 0.1; done; sleep {{.PUSH}}; printf "dep3\n"
# Dep4 waits from Dep1-3 and then indicates that it has started.
dep4:
cmds:
- until [ -f dep1.txt ] && [ -f dep2.txt ] && [ -f dep3.txt ]; do sleep 0.1; done
- touch dep4.txt
- exit 1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
task: Failed to run task "default": task: Failed to run task "dep4": exit status 1
task: Failed to run task "default": task: Failed to run task "test": task: Failed to run task "dep4": exit status 1
Loading