Some test cleanup for flutter_tools. (#90227)

This commit is contained in:
Ian Hickson
2021-10-01 10:38:02 -07:00
committed by GitHub
parent 5ab6c7bce1
commit 4315cdcf76
14 changed files with 69 additions and 57 deletions

View File

@@ -62,7 +62,7 @@ void main() {
expect(archive.findFile('base/assets/flutter_assets/test_assets/asset1.txt') != null, true);
expect(result.exitCode, 0);
}, timeout: const Timeout(Duration(minutes: 5)));
});
testWithoutContext('simple build appbundle all targets succeeds', () async {
final DeferredComponentsProject project = DeferredComponentsProject(BasicDeferredComponentsConfig());
@@ -105,7 +105,7 @@ void main() {
expect(archive.findFile('base/assets/flutter_assets/test_assets/asset1.txt') != null, true);
expect(result.exitCode, 0);
}, timeout: const Timeout(Duration(minutes: 5)));
});
testWithoutContext('simple build appbundle no-deferred-components succeeds', () async {
final DeferredComponentsProject project = DeferredComponentsProject(BasicDeferredComponentsConfig());
@@ -151,7 +151,7 @@ void main() {
expect(archive.findFile('base/assets/flutter_assets/test_assets/asset1.txt') != null, true);
expect(result.exitCode, 0);
}, timeout: const Timeout(Duration(minutes: 5)));
});
testWithoutContext('simple build appbundle mismatched golden no-validate-deferred-components succeeds', () async {
final DeferredComponentsProject project = DeferredComponentsProject(MismatchedGoldenDeferredComponentsConfig());
@@ -198,7 +198,7 @@ void main() {
expect(archive.findFile('base/assets/flutter_assets/test_assets/asset1.txt') != null, true);
expect(result.exitCode, 0);
}, timeout: const Timeout(Duration(minutes: 5)));
});
testWithoutContext('simple build appbundle missing android dynamic feature module fails', () async {
final DeferredComponentsProject project = DeferredComponentsProject(NoAndroidDynamicFeatureModuleDeferredComponentsConfig());

View File

@@ -104,5 +104,5 @@ void main() {
continuePollingValue: '',
matches: equals(vmServiceUri),
);
}, timeout: const Timeout.factor(4));
});
}

View File

@@ -78,6 +78,6 @@ String unsafeString = null;
if (targetPlatform == 'ios') '--no-codesign',
], workingDirectory: projectRoot.path);
expect(result.exitCode, 0);
}, timeout: const Timeout(Duration(minutes: 3)));
});
}
}

View File

@@ -71,6 +71,6 @@ int x = 'String';
contains("A value of type 'String' can't be assigned to a variable of type 'int'."),
);
expect(result.exitCode, 1);
}, timeout: const Timeout(Duration(minutes: 3)));
});
}
}

View File

@@ -69,5 +69,5 @@ void main() {
continuePollingValue: '',
matches: isNotEmpty,
);
}, timeout: const Timeout.factor(4));
});
}

View File

@@ -90,5 +90,5 @@ void main() {
'app-release.apk',
);
expect(fileSystem.file(exampleAppApk), exists);
}, timeout: const Timeout(Duration(minutes: 5)));
});
}

View File

@@ -145,8 +145,6 @@ void main() {
...getLocalEngineArguments(),
'clean',
], workingDirectory: workingDirectory);
}, skip: !platform.isMacOS, // [intended] only makes sense for macos platform.
timeout: const Timeout(Duration(minutes: 5)),
);
}, skip: !platform.isMacOS); // [intended] only makes sense for macos platform.
}
}

View File

@@ -25,10 +25,7 @@
// @dart = 2.8
// This file is ready to transition, just uncomment /*?*/, /*!*/, and /*late*/.
// TODO(gspencergoog): Remove this tag once this test's state leaks/test
// dependencies have been fixed.
// https://github.com/flutter/flutter/issues/85160
// Fails with "flutter test --test-randomize-ordering-seed=1000"
// This file intentionally assumes the tests run in order.
@Tags(<String>['no-shuffle'])
import 'dart:async';
@@ -40,7 +37,7 @@ import 'package:pedantic/pedantic.dart';
import 'package:process/process.dart';
import '../src/common.dart';
import 'test_utils.dart' show fileSystem, platform;
import 'test_utils.dart' show fileSystem;
const ProcessManager processManager = LocalProcessManager();
final String flutterRoot = getFlutterRoot();
@@ -189,7 +186,7 @@ Future<ProcessTestResult> runFlutter(
List<Transition> transitions, {
bool debug = false,
bool logging = true,
Duration expectedMaxDuration = const Duration(minutes: 10), // must be less than test timeout of 15 minutes!
Duration expectedMaxDuration = const Duration(minutes: 10), // must be less than test timeout of 15 minutes! See ../../dart_test.yaml.
}) async {
final Stopwatch clock = Stopwatch()..start();
final Process process = await processManager.start(
@@ -358,7 +355,7 @@ void main() {
} finally {
tryToDelete(fileSystem.directory(tempDirectory));
}
}, skip: platform.isWindows); // https://github.com/flutter/flutter/issues/87924
}, skip: Platform.isWindows); // [intended] Windows doesn't support sending signals so we don't care if it can store the PID.
testWithoutContext('flutter run handle SIGUSR1/2', () async {
final String tempDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_overall_experience_test.').resolveSymbolicLinksSync();
@@ -622,5 +619,5 @@ void main() {
'',
'Application finished.',
]);
}, skip: Platform.isWindows); // TODO(zanderso): Re-enable when this test is reliable on device lab, https://github.com/flutter/flutter/issues/81556
});
}

View File

@@ -148,7 +148,6 @@ Matcher containsIgnoringWhitespace(String toSearch) {
@isTest
void test(String description, FutureOr<void> Function() body, {
String? testOn,
Timeout? timeout,
dynamic skip,
List<String>? tags,
Map<String, dynamic>? onPlatform,
@@ -162,12 +161,14 @@ void test(String description, FutureOr<void> Function() body, {
});
return body();
},
timeout: timeout,
skip: skip,
tags: tags,
onPlatform: onPlatform,
retry: retry,
testOn: testOn,
// We don't support "timeout"; see ../../dart_test.yaml which
// configures all tests to have a 15 minute timeout which should
// definitely be enough.
);
}
@@ -182,7 +183,6 @@ void test(String description, FutureOr<void> Function() body, {
@isTest
void testWithoutContext(String description, FutureOr<void> Function() body, {
String? testOn,
Timeout? timeout,
dynamic skip,
List<String>? tags,
Map<String, dynamic>? onPlatform,
@@ -194,12 +194,14 @@ void testWithoutContext(String description, FutureOr<void> Function() body, {
contextKey: const _NoContext(),
});
},
timeout: timeout,
skip: skip,
tags: tags,
onPlatform: onPlatform,
retry: retry,
testOn: testOn,
// We don't support "timeout"; see ../../dart_test.yaml which
// configures all tests to have a 15 minute timeout which should
// definitely be enough.
);
}

View File

@@ -62,7 +62,6 @@ void testUsingContext(
Map<Type, Generator> overrides = const <Type, Generator>{},
bool initializeFlutterRoot = true,
String testOn,
Timeout timeout,
bool skip, // should default to `false`, but https://github.com/dart-lang/test/issues/545 doesn't allow this
}) {
if (overrides[FileSystem] != null && overrides[ProcessManager] == null) {
@@ -167,7 +166,10 @@ void testUsingContext(
// BotDetector implementation in the overrides.
BotDetector: overrides[BotDetector] ?? () => const FakeBotDetector(true),
});
}, testOn: testOn, skip: skip, timeout: timeout);
}, testOn: testOn, skip: skip);
// We don't support "timeout"; see ../../dart_test.yaml which
// configures all tests to have a 15 minute timeout which should
// definitely be enough.
}
void _printBufferedErrors(AppContext testContext) {

View File

@@ -12,9 +12,9 @@ import 'package:flutter_tools/src/base/os.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/web/chrome.dart';
import '../../src/common.dart';
import '../../src/fake_process_manager.dart';
import '../../src/fakes.dart';
import '../src/common.dart';
import '../src/fake_process_manager.dart';
import '../src/fakes.dart';
const List<String> kChromeArgs = <String>[
'--disable-background-timer-throttling',
@@ -547,7 +547,7 @@ void main() {
contains('Unable to connect to Chrome debug port:'),
);
expect(logger.errorText, contains('SocketException'));
}, timeout: const Timeout.factor(2));
});
}
Future<Chromium> _testLaunchChrome(String userDataDir, FakeProcessManager processManager, ChromiumLauncher chromeLauncher) {