Make timeout more robust (#12969)

This commit is contained in:
Mikkel Nygaard Ravn 2017-11-10 13:51:52 +01:00 committed by GitHub
parent a836201a74
commit e3d5cbc929
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View file

@ -22,6 +22,9 @@ import '../src/context.dart';
const String frameworkRevision = '12345678'; const String frameworkRevision = '12345678';
const String frameworkChannel = 'omega'; const String frameworkChannel = 'omega';
const Timeout createProjectTimeout = const Timeout.factor(2.0);
const Timeout createProjectAndGetPackagesTimeout = const Timeout.factor(10.0);
void main() { void main() {
group('create', () { group('create', () {
Directory temp; Directory temp;
@ -57,7 +60,7 @@ void main() {
'flutter_project.iml', 'flutter_project.iml',
], ],
); );
}, timeout: const Timeout.factor(3.0)); }, timeout: createProjectAndGetPackagesTimeout);
testUsingContext('kotlin/swift project', () async { testUsingContext('kotlin/swift project', () async {
return _createProject( return _createProject(
@ -76,7 +79,7 @@ void main() {
'ios/Runner/main.m', 'ios/Runner/main.m',
], ],
); );
}, timeout: const Timeout.factor(3.0)); }, timeout: createProjectTimeout);
testUsingContext('package project', () async { testUsingContext('package project', () async {
return _createAndAnalyzeProject( return _createAndAnalyzeProject(
@ -103,7 +106,7 @@ void main() {
'test/widget_test.dart', 'test/widget_test.dart',
], ],
); );
}, timeout: const Timeout.factor(3.0)); }, timeout: createProjectAndGetPackagesTimeout);
testUsingContext('plugin project', () async { testUsingContext('plugin project', () async {
return _createAndAnalyzeProject( return _createAndAnalyzeProject(
@ -123,7 +126,7 @@ void main() {
], ],
plugin: true, plugin: true,
); );
}, timeout: const Timeout.factor(3.0)); }, timeout: createProjectAndGetPackagesTimeout);
testUsingContext('kotlin/swift plugin project', () async { testUsingContext('kotlin/swift plugin project', () async {
return _createProject( return _createProject(
@ -149,7 +152,7 @@ void main() {
], ],
plugin: true, plugin: true,
); );
}, timeout: const Timeout.factor(3.0)); }, timeout: createProjectTimeout);
testUsingContext('plugin project with custom org', () async { testUsingContext('plugin project with custom org', () async {
return _createProject( return _createProject(
@ -165,7 +168,7 @@ void main() {
], ],
plugin: true, plugin: true,
); );
}, timeout: const Timeout.factor(3.0)); }, timeout: createProjectTimeout);
testUsingContext('project with-driver-test', () async { testUsingContext('project with-driver-test', () async {
return _createAndAnalyzeProject( return _createAndAnalyzeProject(
@ -173,7 +176,7 @@ void main() {
<String>['--with-driver-test'], <String>['--with-driver-test'],
<String>['lib/main.dart'], <String>['lib/main.dart'],
); );
}, timeout: const Timeout.factor(3.0)); }, timeout: createProjectAndGetPackagesTimeout);
// Verify content and formatting // Verify content and formatting
testUsingContext('content', () async { testUsingContext('content', () async {
@ -249,7 +252,7 @@ void main() {
overrides: <Type, Generator>{ overrides: <Type, Generator>{
FlutterVersion: () => mockFlutterVersion, FlutterVersion: () => mockFlutterVersion,
}, },
timeout: const Timeout.factor(3.0)); timeout: createProjectTimeout);
// Verify that we can regenerate over an existing project. // Verify that we can regenerate over an existing project.
testUsingContext('can re-gen over existing project', () async { testUsingContext('can re-gen over existing project', () async {
@ -261,7 +264,7 @@ void main() {
await runner.run(<String>['create', '--no-pub', projectDir.path]); await runner.run(<String>['create', '--no-pub', projectDir.path]);
await runner.run(<String>['create', '--no-pub', projectDir.path]); await runner.run(<String>['create', '--no-pub', projectDir.path]);
}, timeout: const Timeout.factor(3.0)); }, timeout: createProjectTimeout);
// Verify that we help the user correct an option ordering issue // Verify that we help the user correct an option ordering issue
testUsingContext('produces sensible error message', () async { testUsingContext('produces sensible error message', () async {

View file

@ -17,6 +17,8 @@ import 'package:test/test.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart'; import '../src/context.dart';
const Timeout remotePubTimeout = const Timeout.factor(10.0);
void main() { void main() {
Cache.disableLocking(); Cache.disableLocking();
group('packages get/upgrade', () { group('packages get/upgrade', () {
@ -55,7 +57,7 @@ void main() {
final String projectPath = await runCommand('get'); final String projectPath = await runCommand('get');
expectExists(projectPath, 'lib/main.dart'); expectExists(projectPath, 'lib/main.dart');
expectExists(projectPath, '.packages'); expectExists(projectPath, '.packages');
}, timeout: const Timeout.factor(3.0)); }, timeout: remotePubTimeout);
testUsingContext('get --offline', () async { testUsingContext('get --offline', () async {
final String projectPath = await runCommand('get', args: <String>['--offline']); final String projectPath = await runCommand('get', args: <String>['--offline']);
@ -67,7 +69,7 @@ void main() {
final String projectPath = await runCommand('upgrade'); final String projectPath = await runCommand('upgrade');
expectExists(projectPath, 'lib/main.dart'); expectExists(projectPath, 'lib/main.dart');
expectExists(projectPath, '.packages'); expectExists(projectPath, '.packages');
}, timeout: const Timeout.factor(3.0)); }, timeout: remotePubTimeout);
}); });
group('packages test/pub', () { group('packages test/pub', () {