Skip to content

Address flakes from using temp directory to run tests #2649

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

srujzs
Copy link
Contributor

@srujzs srujzs commented Jul 9, 2025

2172ba7 added support to run tests in a temporary directory.

This results in two flaky issues:

  1. On Windows, build_daemon tests may fail to delete the
    temp directory because the process may have not been torn
    down yet, so it may still be accessing the file system.
    There was an initial retry after 1 second, but that appears
    to be not enough looking at a recent test run. See https://github.com/dart-lang/webdev/actions/runs/16157459808/job/45602784802?pr=2649
    for an example. It's printed as a warning.
  2. If a test times out, its tearDown may not be called. In
    this case, the ResidentWebRunner in frontend_server may not
    restore the current directory in the LocalFileSystem. This
    leads to cascading failures in subsequent tests due to no
    longer being in a path that contains 'webdev'. See
    https://github.com/dart-lang/webdev/actions/runs/15989286213/job/45099373212?pr=2641
    for an example. See tearDown is not called if a test times out test#897
    as well for tracking work to call tearDown on timeouts.

To address the above issues:

  1. Increase the delay between the two tries and assert this
    only occurs on Windows.
  2. Cache the current directory so that it can be used in
    utilities.dart with the same (correct) value every time.

srujzs added 2 commits July 8, 2025 17:34
dart-lang@2172ba7
added support to run tests in a temporary directory.

This results in two flaky issues:

1. On Windows, build_daemon tests may fail to delete the
temp directory because the process may have not been torn
down yet, so it may still be accessing the file system.
There was an initial retry after 1 second, but that appears
to be not enough looking at a recent test run.
2. If a test times out, its tearDown may not be called. In
this case, the ResidentWebRunner in frontend_server may not
restore the current directory in the LocalFileSystem. This
leads to cascading failures in subsequent tests due to no
longer being in a path that contains 'webdev'. See
https://github.com/dart-lang/webdev/actions/runs/15989286213/job/45099373212?pr=2641
for an example. See dart-lang/test#897
as well for tracking work to call tearDown on timeouts.

To address the above issues:

1. Increase the delay between the two tries and assert this
only occurs on Windows.
2. Cache the current directory so that it can be used in
utilities.dart with the same (correct) value every time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant