Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[flutter_tools] rename two unit tests that were not actually being run on CI #98299

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

Merged

Conversation

christopherfujino
Copy link
Contributor

@christopherfujino christopherfujino commented Feb 11, 2022

package:test will only run tests that end in _test.dart. This PR adds a check in //flutter/dev/bots/analyze.dart that validates all test files in package:flutter_tools match this filename convention (see the test for the actual rules for detecting a "test file").

I ended up deleting packages/flutter_tools/test/general.shard/doctor.dart as they were mostly obsolete tests (web and windows desktop are now enabled by default on stable, regardless of feature flags) and were not written correctly.

For packages/flutter_tools/test/commands.shard/hermetic/custom_devices_test.dart I deleted 6 tests which were not passing (the others did pass).

I filed a tracking issue to fix and re-enable the deleted custom devices tests: #98436

@flutter-dashboard flutter-dashboard bot added c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels. labels Feb 11, 2022
@christopherfujino christopherfujino marked this pull request as ready for review February 14, 2022 21:25
// detect files that contains calls to test(), testUsingContext(), and testWithoutContext()
final RegExp callsTestFunctionPattern = RegExp(r'(test\(.*\)|testUsingContext\(.*\)|testWithoutContext\(.*\))');

await for (final File file in _allFiles(toolsTestPath, 'dart', minimumMatches: 42)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remind me, what does minimumMatches do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, I need to change this. I put 42 there to get this working, lol

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the rationale (I asked in #hacker-tests) but what it effectively does is assert that it found more than this before returning. I upped this to 300 as we currently have 357 test files).

@@ -1,60 +0,0 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just delete the one failing test instead of all of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

none of these are testing what they purport to be. The web tests are invalid (now that web is stable the feature flags are effectively ignored), and you should never be able to see multiple desktop platform validators at the same time (how they're shown is dependent on the platform OS).

Finally, when I tried to write a valid test, I couldn't figure out how to mock out the Platform with the testbed runner, as somehow the real platform was leaking through.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it was more than 1 failing: https://ci.chromium.org/b/8822482027585120017

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we can fix up anything we missed in the regexes or file logic as we find problems.

@fluttergithubbot fluttergithubbot merged commit 87fe3fe into flutter:master Feb 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2022
@christopherfujino christopherfujino deleted the ensure_all_test_files_run branch February 15, 2022 17:12
@christopherfujino christopherfujino changed the title rename two unit tests that were not actually being run on CI [flutter_tools] rename two unit tests that were not actually being run on CI Feb 23, 2022
mbriand added a commit to mbriand/flutter that referenced this pull request Feb 25, 2022
clocksmith pushed a commit to clocksmith/flutter that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants