mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

This changes the publishing of archives so that it happens on the chrome_infra bots when they build a packaged branch instead of as part of the dev_roll process. It uses the tagged version in the branch, and leaves the git repo that it clones checked out on the branch and hash used to build the package. It updates metadata located at gs://flutter_infra/releases/releases_.json (where is one of macos, linux, or windows) once published, since it would be complex to do the proper locking to keep them all in one shared .json file safely. A separate [change to the chrome_infra bots](https://chromium-review.googlesource.com/c/chromium/tools/build/+/902823) was made to instruct them to build packaged for the dev, beta, and release branches (but not master anymore).
109 lines
3.8 KiB
Dart
109 lines
3.8 KiB
Dart
// Copyright 2018 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import 'dart:convert';
|
|
import 'dart:io';
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
import 'fake_process_manager.dart';
|
|
|
|
void main() {
|
|
group('ArchivePublisher', () {
|
|
FakeProcessManager processManager;
|
|
final List<String> stdinCaptured = <String>[];
|
|
|
|
void _captureStdin(String item) {
|
|
stdinCaptured.add(item);
|
|
}
|
|
|
|
setUp(() async {
|
|
processManager = new FakeProcessManager(stdinResults: _captureStdin);
|
|
});
|
|
|
|
tearDown(() async {});
|
|
|
|
test('start works', () async {
|
|
final Map<String, List<ProcessResult>> calls = <String, List<ProcessResult>>{
|
|
'gsutil acl get gs://flutter_infra/releases/releases.json': <ProcessResult>[
|
|
new ProcessResult(0, 0, 'output1', '')
|
|
],
|
|
'gsutil cat gs://flutter_infra/releases/releases.json': <ProcessResult>[
|
|
new ProcessResult(0, 0, 'output2', '')
|
|
],
|
|
};
|
|
processManager.fakeResults = calls;
|
|
for (String key in calls.keys) {
|
|
final Process process = await processManager.start(key.split(' '));
|
|
String output = '';
|
|
process.stdout.listen((List<int> item) {
|
|
output += utf8.decode(item);
|
|
});
|
|
await process.exitCode;
|
|
expect(output, equals(calls[key][0].stdout));
|
|
}
|
|
processManager.verifyCalls(calls.keys.toList());
|
|
});
|
|
|
|
test('run works', () async {
|
|
final Map<String, List<ProcessResult>> calls = <String, List<ProcessResult>>{
|
|
'gsutil acl get gs://flutter_infra/releases/releases.json': <ProcessResult>[
|
|
new ProcessResult(0, 0, 'output1', '')
|
|
],
|
|
'gsutil cat gs://flutter_infra/releases/releases.json': <ProcessResult>[
|
|
new ProcessResult(0, 0, 'output2', '')
|
|
],
|
|
};
|
|
processManager.fakeResults = calls;
|
|
for (String key in calls.keys) {
|
|
final ProcessResult result = await processManager.run(key.split(' '));
|
|
expect(result.stdout, equals(calls[key][0].stdout));
|
|
}
|
|
processManager.verifyCalls(calls.keys.toList());
|
|
});
|
|
|
|
test('runSync works', () async {
|
|
final Map<String, List<ProcessResult>> calls = <String, List<ProcessResult>>{
|
|
'gsutil acl get gs://flutter_infra/releases/releases.json': <ProcessResult>[
|
|
new ProcessResult(0, 0, 'output1', '')
|
|
],
|
|
'gsutil cat gs://flutter_infra/releases/releases.json': <ProcessResult>[
|
|
new ProcessResult(0, 0, 'output2', '')
|
|
],
|
|
};
|
|
processManager.fakeResults = calls;
|
|
for (String key in calls.keys) {
|
|
final ProcessResult result = processManager.runSync(key.split(' '));
|
|
expect(result.stdout, equals(calls[key][0].stdout));
|
|
}
|
|
processManager.verifyCalls(calls.keys.toList());
|
|
});
|
|
|
|
test('captures stdin', () async {
|
|
final Map<String, List<ProcessResult>> calls = <String, List<ProcessResult>>{
|
|
'gsutil acl get gs://flutter_infra/releases/releases.json': <ProcessResult>[
|
|
new ProcessResult(0, 0, 'output1', '')
|
|
],
|
|
'gsutil cat gs://flutter_infra/releases/releases.json': <ProcessResult>[
|
|
new ProcessResult(0, 0, 'output2', '')
|
|
],
|
|
};
|
|
processManager.fakeResults = calls;
|
|
for (String key in calls.keys) {
|
|
final Process process = await processManager.start(key.split(' '));
|
|
String output = '';
|
|
process.stdout.listen((List<int> item) {
|
|
output += utf8.decode(item);
|
|
});
|
|
final String testInput = '${calls[key][0].stdout} input';
|
|
process.stdin.add(testInput.codeUnits);
|
|
await process.exitCode;
|
|
expect(output, equals(calls[key][0].stdout));
|
|
expect(stdinCaptured.last, equals(testInput));
|
|
}
|
|
processManager.verifyCalls(calls.keys.toList());
|
|
});
|
|
});
|
|
}
|