Skip to content

The tool integration tests are leaky and need significant work to fix #51421

Closed
@dnfield

Description

@dnfield

This may need to be split into separate issues, but while I still have the context in my head I want to write this out.

See also #51382

Tests in the ingtegration.shard folder tend to have the following structure:

  • Launch Flutter via the shell script entrypoint (flutter.bat or flutter depending on the OS).
  • This might be done multiple times, e.g. to create a project in a temp dir, and then to launch flutter test --start-paused.
  • This causes Flutter to spawn a Dart VM process that is told to never terminate.
  • The test tries to clean things up by connecting to the VM, getting its PID, and eventually killing the process
  • killPid in Dart does not guarantee process death, and does not wait for the process to terminate
  • Killing the shell script invocation does not necessarily kill the launched flutter_tester process, or, if it does, it takes longer than the termination of the shell script itself.
  • The test attempts to delete temporary files, and swallows exceptions. A comment in the source indicates we believe this to be a permissions issue, where in reality it's that we spawned a process that hasn't terminated that is holding an exclusive lock on the files (on Windows).

I attempted to deflake some of this in the linked PR, but my attempts are still flakey because we don't have a handle on the Process to be able to actually wait for it to exit.

We could potentially refactor these tests to not use the flutter/flutter.bat entrypoints so that we can properly control process death. We should also investigate whether flutter test --start-paused leaks processes on Windows.

/cc @zanderso @Hixie @jonahwilliams

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our testsc: contributor-productivityTeam-specific productivity, code health, technical debt.c: flakeTests that sometimes, but not always, incorrectly passteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions