Unverified Commit c936aa8c authored by Mikkel Nygaard Ravn's avatar Mikkel Nygaard Ravn Committed by GitHub

One more timeout. Centralize definitions. (#12970)

parent e3d5cbc9
...@@ -47,7 +47,7 @@ void main() { ...@@ -47,7 +47,7 @@ void main() {
], ],
); );
expect(libMain.existsSync(), isTrue); expect(libMain.existsSync(), isTrue);
}); }, timeout: allowForRemotePubInvocation);
// Analyze in the current directory - no arguments // Analyze in the current directory - no arguments
testUsingContext('flutter analyze working directory', () async { testUsingContext('flutter analyze working directory', () async {
......
...@@ -22,9 +22,6 @@ import '../src/context.dart'; ...@@ -22,9 +22,6 @@ 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;
...@@ -60,7 +57,7 @@ void main() { ...@@ -60,7 +57,7 @@ void main() {
'flutter_project.iml', 'flutter_project.iml',
], ],
); );
}, timeout: createProjectAndGetPackagesTimeout); }, timeout: allowForRemotePubInvocation);
testUsingContext('kotlin/swift project', () async { testUsingContext('kotlin/swift project', () async {
return _createProject( return _createProject(
...@@ -79,7 +76,7 @@ void main() { ...@@ -79,7 +76,7 @@ void main() {
'ios/Runner/main.m', 'ios/Runner/main.m',
], ],
); );
}, timeout: createProjectTimeout); }, timeout: allowForCreateFlutterProject);
testUsingContext('package project', () async { testUsingContext('package project', () async {
return _createAndAnalyzeProject( return _createAndAnalyzeProject(
...@@ -106,7 +103,7 @@ void main() { ...@@ -106,7 +103,7 @@ void main() {
'test/widget_test.dart', 'test/widget_test.dart',
], ],
); );
}, timeout: createProjectAndGetPackagesTimeout); }, timeout: allowForRemotePubInvocation);
testUsingContext('plugin project', () async { testUsingContext('plugin project', () async {
return _createAndAnalyzeProject( return _createAndAnalyzeProject(
...@@ -126,7 +123,7 @@ void main() { ...@@ -126,7 +123,7 @@ void main() {
], ],
plugin: true, plugin: true,
); );
}, timeout: createProjectAndGetPackagesTimeout); }, timeout: allowForRemotePubInvocation);
testUsingContext('kotlin/swift plugin project', () async { testUsingContext('kotlin/swift plugin project', () async {
return _createProject( return _createProject(
...@@ -152,7 +149,7 @@ void main() { ...@@ -152,7 +149,7 @@ void main() {
], ],
plugin: true, plugin: true,
); );
}, timeout: createProjectTimeout); }, timeout: allowForCreateFlutterProject);
testUsingContext('plugin project with custom org', () async { testUsingContext('plugin project with custom org', () async {
return _createProject( return _createProject(
...@@ -168,7 +165,7 @@ void main() { ...@@ -168,7 +165,7 @@ void main() {
], ],
plugin: true, plugin: true,
); );
}, timeout: createProjectTimeout); }, timeout: allowForCreateFlutterProject);
testUsingContext('project with-driver-test', () async { testUsingContext('project with-driver-test', () async {
return _createAndAnalyzeProject( return _createAndAnalyzeProject(
...@@ -176,7 +173,7 @@ void main() { ...@@ -176,7 +173,7 @@ void main() {
<String>['--with-driver-test'], <String>['--with-driver-test'],
<String>['lib/main.dart'], <String>['lib/main.dart'],
); );
}, timeout: createProjectAndGetPackagesTimeout); }, timeout: allowForRemotePubInvocation);
// Verify content and formatting // Verify content and formatting
testUsingContext('content', () async { testUsingContext('content', () async {
...@@ -252,7 +249,7 @@ void main() { ...@@ -252,7 +249,7 @@ void main() {
overrides: <Type, Generator>{ overrides: <Type, Generator>{
FlutterVersion: () => mockFlutterVersion, FlutterVersion: () => mockFlutterVersion,
}, },
timeout: createProjectTimeout); timeout: allowForCreateFlutterProject);
// 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 {
...@@ -264,7 +261,7 @@ void main() { ...@@ -264,7 +261,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: createProjectTimeout); }, timeout: allowForCreateFlutterProject);
// 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 {
......
...@@ -17,8 +17,6 @@ import 'package:test/test.dart'; ...@@ -17,8 +17,6 @@ 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', () {
...@@ -57,7 +55,7 @@ void main() { ...@@ -57,7 +55,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: remotePubTimeout); }, timeout: allowForRemotePubInvocation);
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']);
...@@ -69,7 +67,7 @@ void main() { ...@@ -69,7 +67,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: remotePubTimeout); }, timeout: allowForRemotePubInvocation);
}); });
group('packages test/pub', () { group('packages test/pub', () {
......
...@@ -97,3 +97,10 @@ Future<String> createProject(Directory temp) async { ...@@ -97,3 +97,10 @@ Future<String> createProject(Directory temp) async {
await runner.run(<String>['create', '--no-pub', projectPath]); await runner.run(<String>['create', '--no-pub', projectPath]);
return projectPath; return projectPath;
} }
/// Test case timeout for tests involving remote calls to `pub get` or similar.
const Timeout allowForRemotePubInvocation = const Timeout.factor(10.0);
/// Test case timeout for tests involving creating a Flutter project with
/// `--no-pub`. Use [allowForRemotePubInvocation] when creation involves `pub`.
const Timeout allowForCreateFlutterProject = const Timeout.factor(2.0);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment