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() {
],
);
expect(libMain.existsSync(), isTrue);
});
}, timeout: allowForRemotePubInvocation);
// Analyze in the current directory - no arguments
testUsingContext('flutter analyze working directory', () async {
......
......@@ -22,9 +22,6 @@ 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;
......@@ -60,7 +57,7 @@ void main() {
'flutter_project.iml',
],
);
}, timeout: createProjectAndGetPackagesTimeout);
}, timeout: allowForRemotePubInvocation);
testUsingContext('kotlin/swift project', () async {
return _createProject(
......@@ -79,7 +76,7 @@ void main() {
'ios/Runner/main.m',
],
);
}, timeout: createProjectTimeout);
}, timeout: allowForCreateFlutterProject);
testUsingContext('package project', () async {
return _createAndAnalyzeProject(
......@@ -106,7 +103,7 @@ void main() {
'test/widget_test.dart',
],
);
}, timeout: createProjectAndGetPackagesTimeout);
}, timeout: allowForRemotePubInvocation);
testUsingContext('plugin project', () async {
return _createAndAnalyzeProject(
......@@ -126,7 +123,7 @@ void main() {
],
plugin: true,
);
}, timeout: createProjectAndGetPackagesTimeout);
}, timeout: allowForRemotePubInvocation);
testUsingContext('kotlin/swift plugin project', () async {
return _createProject(
......@@ -152,7 +149,7 @@ void main() {
],
plugin: true,
);
}, timeout: createProjectTimeout);
}, timeout: allowForCreateFlutterProject);
testUsingContext('plugin project with custom org', () async {
return _createProject(
......@@ -168,7 +165,7 @@ void main() {
],
plugin: true,
);
}, timeout: createProjectTimeout);
}, timeout: allowForCreateFlutterProject);
testUsingContext('project with-driver-test', () async {
return _createAndAnalyzeProject(
......@@ -176,7 +173,7 @@ void main() {
<String>['--with-driver-test'],
<String>['lib/main.dart'],
);
}, timeout: createProjectAndGetPackagesTimeout);
}, timeout: allowForRemotePubInvocation);
// Verify content and formatting
testUsingContext('content', () async {
......@@ -252,7 +249,7 @@ void main() {
overrides: <Type, Generator>{
FlutterVersion: () => mockFlutterVersion,
},
timeout: createProjectTimeout);
timeout: allowForCreateFlutterProject);
// Verify that we can regenerate over an existing project.
testUsingContext('can re-gen over existing project', () async {
......@@ -264,7 +261,7 @@ void main() {
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
testUsingContext('produces sensible error message', () async {
......
......@@ -17,8 +17,6 @@ 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', () {
......@@ -57,7 +55,7 @@ void main() {
final String projectPath = await runCommand('get');
expectExists(projectPath, 'lib/main.dart');
expectExists(projectPath, '.packages');
}, timeout: remotePubTimeout);
}, timeout: allowForRemotePubInvocation);
testUsingContext('get --offline', () async {
final String projectPath = await runCommand('get', args: <String>['--offline']);
......@@ -69,7 +67,7 @@ void main() {
final String projectPath = await runCommand('upgrade');
expectExists(projectPath, 'lib/main.dart');
expectExists(projectPath, '.packages');
}, timeout: remotePubTimeout);
}, timeout: allowForRemotePubInvocation);
});
group('packages test/pub', () {
......
......@@ -96,4 +96,11 @@ Future<String> createProject(Directory temp) async {
final CommandRunner<Null> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', projectPath]);
return projectPath;
}
\ No newline at end of file
}
/// 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