changed subprocesses to async from sync (#89668)
* changed subprocess to async from sync
This commit is contained in:
@@ -56,8 +56,8 @@ void main() {
|
||||
);
|
||||
final FakeCodesignCommand command = FakeCodesignCommand(
|
||||
checkouts: checkouts,
|
||||
binariesWithEntitlements: binariesWithEntitlements,
|
||||
binariesWithoutEntitlements: binariesWithoutEntitlements,
|
||||
binariesWithEntitlements: Future<List<String>>.value(binariesWithEntitlements),
|
||||
binariesWithoutEntitlements: Future<List<String>>.value(binariesWithoutEntitlements),
|
||||
flutterRoot: fileSystem.directory(flutterRoot),
|
||||
);
|
||||
runner = CommandRunner<void>('codesign-test', '')
|
||||
@@ -326,8 +326,8 @@ void main() {
|
||||
),
|
||||
...codesignCheckCommands,
|
||||
]);
|
||||
expect(
|
||||
() async => runner.run(<String>['codesign', '--$kVerify', '--$kRevision', revision]),
|
||||
await expectLater(
|
||||
() => runner.run(<String>['codesign', '--$kVerify', '--$kRevision', revision]),
|
||||
throwsExceptionWith('Test failed because unsigned binaries detected.'),
|
||||
);
|
||||
expect(processManager.hasRemainingExpectations, false);
|
||||
@@ -413,8 +413,8 @@ void main() {
|
||||
),
|
||||
...codesignCheckCommands,
|
||||
]);
|
||||
expect(
|
||||
() async => runner.run(<String>['codesign', '--$kVerify', '--$kRevision', revision]),
|
||||
await expectLater(
|
||||
() => runner.run(<String>['codesign', '--$kVerify', '--$kRevision', revision]),
|
||||
throwsExceptionWith('Test failed because files found with the wrong entitlements'),
|
||||
);
|
||||
expect(processManager.hasRemainingExpectations, false);
|
||||
@@ -495,8 +495,8 @@ class FakeCodesignCommand extends CodesignCommand {
|
||||
}) : super(checkouts: checkouts, flutterRoot: flutterRoot);
|
||||
|
||||
@override
|
||||
final List<String> binariesWithEntitlements;
|
||||
final Future<List<String>> binariesWithEntitlements;
|
||||
|
||||
@override
|
||||
final List<String> binariesWithoutEntitlements;
|
||||
final Future<List<String>> binariesWithoutEntitlements;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('canCherryPick returns true if git cherry-pick returns 0', () {
|
||||
test('canCherryPick returns true if git cherry-pick returns 0', () async {
|
||||
const String commit = 'abc123';
|
||||
|
||||
final TestStdio stdio = TestStdio();
|
||||
@@ -73,10 +73,10 @@ void main() {
|
||||
stdio: stdio,
|
||||
);
|
||||
final Repository repository = FrameworkRepository(checkouts);
|
||||
expect(repository.canCherryPick(commit), true);
|
||||
expect(await repository.canCherryPick(commit), true);
|
||||
});
|
||||
|
||||
test('canCherryPick returns false if git cherry-pick returns non-zero', () {
|
||||
test('canCherryPick returns false if git cherry-pick returns non-zero', () async {
|
||||
const String commit = 'abc123';
|
||||
|
||||
final TestStdio stdio = TestStdio();
|
||||
@@ -128,10 +128,10 @@ void main() {
|
||||
stdio: stdio,
|
||||
);
|
||||
final Repository repository = FrameworkRepository(checkouts);
|
||||
expect(repository.canCherryPick(commit), false);
|
||||
expect(await repository.canCherryPick(commit), false);
|
||||
});
|
||||
|
||||
test('cherryPick() applies the commit', () {
|
||||
test('cherryPick() applies the commit', () async {
|
||||
const String commit = 'abc123';
|
||||
|
||||
final TestStdio stdio = TestStdio();
|
||||
@@ -172,11 +172,11 @@ void main() {
|
||||
stdio: stdio,
|
||||
);
|
||||
final Repository repository = FrameworkRepository(checkouts);
|
||||
repository.cherryPick(commit);
|
||||
await repository.cherryPick(commit);
|
||||
expect(processManager.hasRemainingExpectations, false);
|
||||
});
|
||||
|
||||
test('updateDartRevision() updates the DEPS file', () {
|
||||
test('updateDartRevision() updates the DEPS file', () async {
|
||||
const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef';
|
||||
const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e';
|
||||
final TestStdio stdio = TestStdio();
|
||||
@@ -194,7 +194,7 @@ void main() {
|
||||
final EngineRepository repo = EngineRepository(checkouts);
|
||||
final File depsFile = fileSystem.file('/DEPS');
|
||||
depsFile.writeAsStringSync(generateMockDeps(previousDartRevision));
|
||||
repo.updateDartRevision(nextDartRevision, depsFile: depsFile);
|
||||
await repo.updateDartRevision(nextDartRevision, depsFile: depsFile);
|
||||
final String updatedDepsFileContent = depsFile.readAsStringSync();
|
||||
expect(updatedDepsFileContent, generateMockDeps(nextDartRevision));
|
||||
});
|
||||
@@ -219,7 +219,7 @@ void main() {
|
||||
vars = {
|
||||
}''');
|
||||
expect(
|
||||
() => repo.updateDartRevision(nextDartRevision, depsFile: depsFile),
|
||||
() async => repo.updateDartRevision(nextDartRevision, depsFile: depsFile),
|
||||
throwsExceptionWith('Unexpected content in the DEPS file at'),
|
||||
);
|
||||
});
|
||||
@@ -278,7 +278,7 @@ vars = {
|
||||
|
||||
final EngineRepository repo = EngineRepository(checkouts);
|
||||
expect(
|
||||
() => repo.commit(message),
|
||||
() async => repo.commit(message),
|
||||
throwsExceptionWith('Tried to commit with message $message but no changes were present'),
|
||||
);
|
||||
});
|
||||
@@ -338,7 +338,7 @@ vars = {
|
||||
repo.commit(message);
|
||||
});
|
||||
|
||||
test('updateEngineRevision() returns false if newCommit is the same as version file', () {
|
||||
test('updateEngineRevision() returns false if newCommit is the same as version file', () async {
|
||||
const String commit1 = 'abc123';
|
||||
const String commit2 = 'def456';
|
||||
final TestStdio stdio = TestStdio();
|
||||
@@ -371,7 +371,7 @@ vars = {
|
||||
);
|
||||
|
||||
final FrameworkRepository repo = FrameworkRepository(checkouts);
|
||||
final bool didUpdate = repo.updateEngineRevision(commit2, engineVersionFile: engineVersionFile);
|
||||
final bool didUpdate = await repo.updateEngineRevision(commit2, engineVersionFile: engineVersionFile);
|
||||
expect(didUpdate, false);
|
||||
});
|
||||
|
||||
@@ -385,7 +385,7 @@ vars = {
|
||||
);
|
||||
});
|
||||
|
||||
test('ciYaml.enableBranch() will prepend the given branch to the yaml list of enabled_branches', () {
|
||||
test('ciYaml.enableBranch() will prepend the given branch to the yaml list of enabled_branches', () async {
|
||||
const String commit1 = 'abc123';
|
||||
final TestStdio stdio = TestStdio();
|
||||
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
||||
@@ -430,18 +430,18 @@ enabled_branches:
|
||||
|
||||
final FrameworkRepository framework = FrameworkRepository(checkouts);
|
||||
expect(
|
||||
framework.ciYaml.enabledBranches,
|
||||
(await framework.ciYaml).enabledBranches,
|
||||
<String>['master', 'dev', 'beta', 'stable'],
|
||||
);
|
||||
|
||||
framework.ciYaml.enableBranch('foo');
|
||||
(await framework.ciYaml).enableBranch('foo');
|
||||
expect(
|
||||
framework.ciYaml.enabledBranches,
|
||||
(await framework.ciYaml).enabledBranches,
|
||||
<String>['foo', 'master', 'dev', 'beta', 'stable'],
|
||||
);
|
||||
|
||||
expect(
|
||||
framework.ciYaml.stringContents,
|
||||
(await framework.ciYaml).stringContents,
|
||||
'''
|
||||
# Friendly note
|
||||
|
||||
@@ -498,7 +498,7 @@ enabled_branches:
|
||||
|
||||
final FrameworkRepository framework = FrameworkRepository(checkouts);
|
||||
expect(
|
||||
() => framework.ciYaml.enableBranch('master'),
|
||||
() async => (await framework.ciYaml).enableBranch('master'),
|
||||
throwsExceptionWith('.ci.yaml already contains the branch master'),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ void main() {
|
||||
remote: remote,
|
||||
);
|
||||
expect(
|
||||
() => rollDev(
|
||||
() async => rollDev(
|
||||
argResults: fakeArgResults,
|
||||
repository: repo,
|
||||
stdio: stdio,
|
||||
@@ -95,7 +95,7 @@ void main() {
|
||||
remote: remote,
|
||||
);
|
||||
expect(
|
||||
() => rollDev(
|
||||
() async => rollDev(
|
||||
argResults: fakeArgResults,
|
||||
repository: repo,
|
||||
stdio: stdio,
|
||||
@@ -105,7 +105,7 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('does not reset or tag if --just-print is specified', () {
|
||||
test('does not reset or tag if --just-print is specified', () async {
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
const FakeCommand(command: <String>[
|
||||
'git',
|
||||
@@ -166,7 +166,7 @@ void main() {
|
||||
justPrint: true,
|
||||
);
|
||||
expect(
|
||||
rollDev(
|
||||
await rollDev(
|
||||
usage: usage,
|
||||
argResults: fakeArgResults,
|
||||
repository: repo,
|
||||
@@ -249,7 +249,7 @@ void main() {
|
||||
skipTagging: true,
|
||||
);
|
||||
expect(
|
||||
() => rollDev(
|
||||
() async => rollDev(
|
||||
usage: usage,
|
||||
argResults: fakeArgResults,
|
||||
repository: repo,
|
||||
@@ -320,7 +320,7 @@ void main() {
|
||||
justPrint: true,
|
||||
);
|
||||
expect(
|
||||
() => rollDev(
|
||||
() async => rollDev(
|
||||
usage: usage,
|
||||
argResults: fakeArgResults,
|
||||
repository: repo,
|
||||
@@ -403,7 +403,7 @@ void main() {
|
||||
const String errorMessage = 'The previous dev tag $lastVersion is not a '
|
||||
'direct ancestor of $commit.';
|
||||
expect(
|
||||
() => rollDev(
|
||||
() async => rollDev(
|
||||
argResults: fakeArgResults,
|
||||
repository: repo,
|
||||
stdio: stdio,
|
||||
@@ -413,7 +413,7 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('does not tag but updates branch if --skip-tagging provided', () {
|
||||
test('does not tag but updates branch if --skip-tagging provided', () async {
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
const FakeCommand(command: <String>[
|
||||
'git',
|
||||
@@ -498,7 +498,7 @@ void main() {
|
||||
skipTagging: true,
|
||||
);
|
||||
expect(
|
||||
rollDev(
|
||||
await rollDev(
|
||||
usage: usage,
|
||||
argResults: fakeArgResults,
|
||||
repository: repo,
|
||||
@@ -508,7 +508,7 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('successfully tags and publishes release', () {
|
||||
test('successfully tags and publishes release', () async {
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
const FakeCommand(command: <String>[
|
||||
'git',
|
||||
@@ -597,7 +597,7 @@ void main() {
|
||||
remote: remote,
|
||||
);
|
||||
expect(
|
||||
rollDev(
|
||||
await rollDev(
|
||||
usage: usage,
|
||||
argResults: fakeArgResults,
|
||||
repository: repo,
|
||||
@@ -607,7 +607,7 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('successfully publishes release with --force', () {
|
||||
test('successfully publishes release with --force', () async {
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
const FakeCommand(command: <String>[
|
||||
'git',
|
||||
@@ -692,7 +692,7 @@ void main() {
|
||||
force: true,
|
||||
);
|
||||
expect(
|
||||
rollDev(
|
||||
await rollDev(
|
||||
argResults: fakeArgResults,
|
||||
repository: repo,
|
||||
stdio: stdio,
|
||||
|
||||
Reference in New Issue
Block a user