Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Flaky TestForDeps tests #1839

Merged
merged 3 commits into from
Oct 6, 2024

Conversation

pbitty
Copy link
Contributor

@pbitty pbitty commented Sep 26, 2024

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 #1819.

pbitty and others added 3 commits September 26, 2024 08:17
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.
This reverts commit e4c4b0c.
@pbitty
Copy link
Contributor Author

pbitty commented Sep 26, 2024

With the debug print output:

  • Prior to the fix:
% go test -run TestForDeps/loop-explicit -count 1
len: 1
len: 1
len: 1
len: 1
len: 1
len: 1
PASS
ok  	github.com/go-task/task/v3	0.802s
  • After the fix:
% go test -run TestForDeps/loop-explicit -count 1
len: 0
len: 2
len: 0
len: 2
len: 0
len: 2
PASS
ok  	github.com/go-task/task/v3	0.590s

The 2-character output of each task gets lumped together into a single Write() call.

@andreynering
Copy link
Member

Thanks @pbitty!

@andreynering andreynering merged commit c5eea29 into go-task:main Oct 6, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky TestForDeps/loop-matrix test
2 participants