From e3d5cbc929bd43c0de2733310c5efedf1185ec74 Mon Sep 17 00:00:00 2001 From: Mikkel Nygaard Ravn Date: Fri, 10 Nov 2017 13:51:52 +0100 Subject: [PATCH] Make timeout more robust (#12969) --- .../test/commands/create_test.dart | 21 +++++++++++-------- .../test/commands/packages_test.dart | 6 ++++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/flutter_tools/test/commands/create_test.dart b/packages/flutter_tools/test/commands/create_test.dart index 43976fea73..31fe72f5ff 100644 --- a/packages/flutter_tools/test/commands/create_test.dart +++ b/packages/flutter_tools/test/commands/create_test.dart @@ -22,6 +22,9 @@ import '../src/context.dart'; const String frameworkRevision = '12345678'; const String frameworkChannel = 'omega'; +const Timeout createProjectTimeout = const Timeout.factor(2.0); +const Timeout createProjectAndGetPackagesTimeout = const Timeout.factor(10.0); + void main() { group('create', () { Directory temp; @@ -57,7 +60,7 @@ void main() { 'flutter_project.iml', ], ); - }, timeout: const Timeout.factor(3.0)); + }, timeout: createProjectAndGetPackagesTimeout); testUsingContext('kotlin/swift project', () async { return _createProject( @@ -76,7 +79,7 @@ void main() { 'ios/Runner/main.m', ], ); - }, timeout: const Timeout.factor(3.0)); + }, timeout: createProjectTimeout); testUsingContext('package project', () async { return _createAndAnalyzeProject( @@ -103,7 +106,7 @@ void main() { 'test/widget_test.dart', ], ); - }, timeout: const Timeout.factor(3.0)); + }, timeout: createProjectAndGetPackagesTimeout); testUsingContext('plugin project', () async { return _createAndAnalyzeProject( @@ -123,7 +126,7 @@ void main() { ], plugin: true, ); - }, timeout: const Timeout.factor(3.0)); + }, timeout: createProjectAndGetPackagesTimeout); testUsingContext('kotlin/swift plugin project', () async { return _createProject( @@ -149,7 +152,7 @@ void main() { ], plugin: true, ); - }, timeout: const Timeout.factor(3.0)); + }, timeout: createProjectTimeout); testUsingContext('plugin project with custom org', () async { return _createProject( @@ -165,7 +168,7 @@ void main() { ], plugin: true, ); - }, timeout: const Timeout.factor(3.0)); + }, timeout: createProjectTimeout); testUsingContext('project with-driver-test', () async { return _createAndAnalyzeProject( @@ -173,7 +176,7 @@ void main() { ['--with-driver-test'], ['lib/main.dart'], ); - }, timeout: const Timeout.factor(3.0)); + }, timeout: createProjectAndGetPackagesTimeout); // Verify content and formatting testUsingContext('content', () async { @@ -249,7 +252,7 @@ void main() { overrides: { FlutterVersion: () => mockFlutterVersion, }, - timeout: const Timeout.factor(3.0)); + timeout: createProjectTimeout); // Verify that we can regenerate over an existing project. testUsingContext('can re-gen over existing project', () async { @@ -261,7 +264,7 @@ void main() { await runner.run(['create', '--no-pub', projectDir.path]); await runner.run(['create', '--no-pub', projectDir.path]); - }, timeout: const Timeout.factor(3.0)); + }, timeout: createProjectTimeout); // Verify that we help the user correct an option ordering issue testUsingContext('produces sensible error message', () async { diff --git a/packages/flutter_tools/test/commands/packages_test.dart b/packages/flutter_tools/test/commands/packages_test.dart index 770564aa12..ab107e58a7 100644 --- a/packages/flutter_tools/test/commands/packages_test.dart +++ b/packages/flutter_tools/test/commands/packages_test.dart @@ -17,6 +17,8 @@ import 'package:test/test.dart'; import '../src/common.dart'; import '../src/context.dart'; +const Timeout remotePubTimeout = const Timeout.factor(10.0); + void main() { Cache.disableLocking(); group('packages get/upgrade', () { @@ -55,7 +57,7 @@ void main() { final String projectPath = await runCommand('get'); expectExists(projectPath, 'lib/main.dart'); expectExists(projectPath, '.packages'); - }, timeout: const Timeout.factor(3.0)); + }, timeout: remotePubTimeout); testUsingContext('get --offline', () async { final String projectPath = await runCommand('get', args: ['--offline']); @@ -67,7 +69,7 @@ void main() { final String projectPath = await runCommand('upgrade'); expectExists(projectPath, 'lib/main.dart'); expectExists(projectPath, '.packages'); - }, timeout: const Timeout.factor(3.0)); + }, timeout: remotePubTimeout); }); group('packages test/pub', () {