Skip to content

devicelab test for flutter install with an invalid --flavor cannot fail #133713

@andrewkolos

Description

@andrewkolos

There is a check in flavors_test.dart that can never fail, even when it should. There are also similar checks in flavors_test_ios.dart and flavors_test_macos, but the rest of this text will focus on flavors_test.dart for the sake of brevity.

See

await inDirectory('${flutterDirectory.path}/dev/integration_tests/flavors', () async {
.

This block effectively contains captures two checks:

  1. That flutter install and flutter install --uninstall-only works when --flavor is used (code), and
  2. That flutter install fails when given an invalid --flavor (code) (and that the error message is useful).

In the second test, we return TaskResult.failure('Should not succeed with bogus flavor'); if the check fails. However, this result isn't used. To demonstrate, you can move this can invert the condition of the if statement containing the return TaskResult.failure statement, and the test will still pass.

You can run the test locally from the dev/devicelab directory using this command:

../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t flavors_test

You may need to set ANDROID_SDK_ROOT before this. See dev/devicelab/README.md for more details.

Ideally, the fix would be to capture the return value of the inDirectory call and return that.

Other issues:

  • flavors_test (meant for Android devices) doesn't test for the correct error string when trying to build with an invalid flavor (--flavor bogus). It tests for Xcode output, which will never be found because the test isn't building for iOS or MacOS
  • flavors_test_ios tests for Xcode output, but it tests for an outdated string

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listteam-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