Skip to content

[flutter_tools] standardize patterns for integration.shard#64980

Merged
jonahwilliams merged 9 commits intoflutter:masterfrom
jonahwilliams:remove_integration_test_globals
Sep 8, 2020
Merged

[flutter_tools] standardize patterns for integration.shard#64980
jonahwilliams merged 9 commits intoflutter:masterfrom
jonahwilliams:remove_integration_test_globals

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Aug 31, 2020

Description

Integration tests must only go through the real file system/process manager/platform. The global indirection makes this code harder to understand than if it directly referred to the concrete instances that are being used.

Update the integration shard to use a const instance of a LocalFIleSystem, LocalProcessManager, and LocalPlatform. Remove global usage and apply testWithoutContext.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 31, 2020

import '../src/common.dart';

const FileSystem fileSystem = LocalFileSystem();
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't have to be in this PR, but should this be moved to the integration shard?

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 wasn't sure. It is definitely touching the real filesystem, but it is also more of an analysis check - I could see wanting it to remain fast.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it run in parallel with other general shard tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes ... hopefully those aren't also writing to the filesytem...hmm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we should probably just move this?

Copy link
Contributor

Choose a reason for hiding this comment

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

i vote move them just to be safe and rule out the potential flaking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

final List<String> allowedPath = <String>[
globals.fs.path.join(flutterTools, 'lib', 'src', 'base', 'file_system.dart'),
fileSystem.path.join(flutterTools, 'test', 'general.shard', 'forbidden_imports_test.dart'),
fileSystem.path.join(flutterTools, 'test', 'integration.shard', 'test_utils.dart'),
Copy link
Contributor

Choose a reason for hiding this comment

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

would it be possible to allow the entire //test/integration.shard/ dir?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we could - this sort of enforces using the existing test_utils, which could be helpful if we do want to change the file system in the future

Copy link
Contributor

Choose a reason for hiding this comment

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

oh yeah, makes sense

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

LGTM

@jonahwilliams
Copy link
Contributor Author

This does not affect google3 unless they are trying to run our integration tests.

@jonahwilliams jonahwilliams merged commit 6b444c4 into flutter:master Sep 8, 2020
@jonahwilliams jonahwilliams deleted the remove_integration_test_globals branch September 8, 2020 22:56
Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

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

sorry for the late comment.


import '../src/common.dart';

/// The [FileSystem] for the integration test environment.
Copy link
Member

Choose a reason for hiding this comment

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

How about a test in forbidden_imports_test.dart that checks that this file isn't imported outside of the integration.shard subdir?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants