Skip to content

Commit

Permalink
fix: Flaky TestForDeps tests
Browse files Browse the repository at this point in the history
The executor output for parallel task (and dep)
execution can come out one character at a time,
so even though the tests use `SyncWriter, the
writer's lock doesn't prevent interleaving.

Using `group` output forces the task output to be
buffered and kept together before being printed.

Fixes go-task#1819.
  • Loading branch information
pbitty committed Sep 26, 2024
1 parent e4c4b0c commit 55dcf5b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,8 @@ func TestForDeps(t *testing.T) {
Stderr: &buff,
Silent: true,
Force: true,
// Force output of each dep to be grouped together to prevent interleaving
OutputStyle: ast.Output{Name: "group"},
}
require.NoError(t, e.Setup())
require.NoError(t, e.Run(context.Background(), &ast.Call{Task: test.name}))
Expand Down

0 comments on commit 55dcf5b

Please sign in to comment.