Unverified Commit 1b9cba4b authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Make sure we refer to 'stable', and not 'release' branch. (#23745)

parent b8c3e0db
...@@ -45,7 +45,7 @@ class ProcessRunnerException implements Exception { ...@@ -45,7 +45,7 @@ class ProcessRunnerException implements Exception {
} }
} }
enum Branch { dev, beta, release } enum Branch { dev, beta, stable }
String getBranchName(Branch branch) { String getBranchName(Branch branch) {
switch (branch) { switch (branch) {
...@@ -53,8 +53,8 @@ String getBranchName(Branch branch) { ...@@ -53,8 +53,8 @@ String getBranchName(Branch branch) {
return 'beta'; return 'beta';
case Branch.dev: case Branch.dev:
return 'dev'; return 'dev';
case Branch.release: case Branch.stable:
return 'release'; return 'stable';
} }
return null; return null;
} }
...@@ -65,8 +65,8 @@ Branch fromBranchName(String name) { ...@@ -65,8 +65,8 @@ Branch fromBranchName(String name) {
return Branch.beta; return Branch.beta;
case 'dev': case 'dev':
return Branch.dev; return Branch.dev;
case 'release': case 'stable':
return Branch.release; return Branch.stable;
default: default:
throw ArgumentError('Invalid branch name.'); throw ArgumentError('Invalid branch name.');
} }
......
...@@ -221,7 +221,7 @@ void main() { ...@@ -221,7 +221,7 @@ void main() {
final String archiveName = platform.isLinux ? 'archive.tar.xz' : 'archive.zip'; final String archiveName = platform.isLinux ? 'archive.tar.xz' : 'archive.zip';
final String archiveMime = platform.isLinux ? 'application/x-gtar' : 'application/zip'; final String archiveMime = platform.isLinux ? 'application/x-gtar' : 'application/zip';
final String archivePath = path.join(tempDir.absolute.path, archiveName); final String archivePath = path.join(tempDir.absolute.path, archiveName);
final String gsArchivePath = 'gs://flutter_infra/releases/release/$platformName/$archiveName'; final String gsArchivePath = 'gs://flutter_infra/releases/stable/$platformName/$archiveName';
final String jsonPath = path.join(tempDir.absolute.path, releasesName); final String jsonPath = path.join(tempDir.absolute.path, releasesName);
final String gsJsonPath = 'gs://flutter_infra/releases/$releasesName'; final String gsJsonPath = 'gs://flutter_infra/releases/$releasesName';
final String releasesJson = '''{ final String releasesJson = '''{
...@@ -247,10 +247,10 @@ void main() { ...@@ -247,10 +247,10 @@ void main() {
}, },
{ {
"hash": "$testRef", "hash": "$testRef",
"channel": "release", "channel": "stable",
"version": "v0.0.0", "version": "v0.0.0",
"release_date": "2018-03-20T01:47:02.851729Z", "release_date": "2018-03-20T01:47:02.851729Z",
"archive": "release/$platformName/flutter_${platformName}_v0.0.0-dev.zip" "archive": "stable/$platformName/flutter_${platformName}_v0.0.0-dev.zip"
} }
] ]
} }
...@@ -269,7 +269,7 @@ void main() { ...@@ -269,7 +269,7 @@ void main() {
final ArchivePublisher publisher = ArchivePublisher( final ArchivePublisher publisher = ArchivePublisher(
tempDir, tempDir,
testRef, testRef,
Branch.release, Branch.stable,
'v1.2.3', 'v1.2.3',
outputFile, outputFile,
processManager: processManager, processManager: processManager,
...@@ -284,8 +284,8 @@ void main() { ...@@ -284,8 +284,8 @@ void main() {
final String contents = releaseFile.readAsStringSync(); final String contents = releaseFile.readAsStringSync();
// Make sure new data is added. // Make sure new data is added.
expect(contents, contains('"hash": "$testRef"')); expect(contents, contains('"hash": "$testRef"'));
expect(contents, contains('"channel": "release"')); expect(contents, contains('"channel": "stable"'));
expect(contents, contains('"archive": "release/$platformName/$archiveName"')); expect(contents, contains('"archive": "stable/$platformName/$archiveName"'));
// Make sure existing entries are preserved. // Make sure existing entries are preserved.
expect(contents, contains('"hash": "5a58b36e36b8d7aace89d3950e6deb307956a6a0"')); expect(contents, contains('"hash": "5a58b36e36b8d7aace89d3950e6deb307956a6a0"'));
expect(contents, contains('"hash": "b9bd51cc36b706215915711e580851901faebb40"')); expect(contents, contains('"hash": "b9bd51cc36b706215915711e580851901faebb40"'));
......
...@@ -47,7 +47,7 @@ class FlutterVersion { ...@@ -47,7 +47,7 @@ class FlutterVersion {
'master', 'master',
'dev', 'dev',
'beta', 'beta',
'release', 'stable',
]); ]);
/// This maps old branch names to the names of branches that replaced them. /// This maps old branch names to the names of branches that replaced them.
...@@ -63,7 +63,7 @@ class FlutterVersion { ...@@ -63,7 +63,7 @@ class FlutterVersion {
String _channel; String _channel;
/// The channel is the upstream branch. /// The channel is the upstream branch.
/// `master`, `dev`, `beta`, `release`; or old ones, like `alpha`, `hackathon`, ... /// `master`, `dev`, `beta`, `stable`; or old ones, like `alpha`, `hackathon`, ...
String get channel => _channel; String get channel => _channel;
/// The name of the local branch. /// The name of the local branch.
......
...@@ -56,8 +56,10 @@ void main() { ...@@ -56,8 +56,10 @@ void main() {
final Process process = createMockProcess( final Process process = createMockProcess(
stdout: 'origin/dev\n' stdout: 'origin/dev\n'
'origin/beta\n' 'origin/beta\n'
'origin/stable\n'
'upstream/dev\n' 'upstream/dev\n'
'upstream/beta\n'); 'upstream/beta\n'
'upstream/stable\n');
when(mockProcessManager.start( when(mockProcessManager.start(
<String>['git', 'branch', '-r'], <String>['git', 'branch', '-r'],
workingDirectory: anyNamed('workingDirectory'), workingDirectory: anyNamed('workingDirectory'),
...@@ -83,7 +85,7 @@ void main() { ...@@ -83,7 +85,7 @@ void main() {
.where((String line) => line?.isNotEmpty == true) .where((String line) => line?.isNotEmpty == true)
.skip(1); // remove `Flutter channels:` line .skip(1); // remove `Flutter channels:` line
expect(rows, <String>['dev', 'beta']); expect(rows, <String>['dev', 'beta', 'stable']);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
}); });
...@@ -127,6 +129,40 @@ void main() { ...@@ -127,6 +129,40 @@ void main() {
expect(testLogger.statusText, contains("Switching to flutter channel 'beta'...")); expect(testLogger.statusText, contains("Switching to flutter channel 'beta'..."));
expect(testLogger.errorText, hasLength(0)); expect(testLogger.errorText, hasLength(0));
when(mockProcessManager.start(
<String>['git', 'fetch'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenAnswer((_) => Future<Process>.value(createMockProcess()));
when(mockProcessManager.start(
<String>['git', 'show-ref', '--verify', '--quiet', 'refs/heads/stable'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenAnswer((_) => Future<Process>.value(createMockProcess()));
when(mockProcessManager.start(
<String>['git', 'checkout', 'stable', '--'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenAnswer((_) => Future<Process>.value(createMockProcess()));
await runner.run(<String>['channel', 'stable']);
verify(mockProcessManager.start(
<String>['git', 'fetch'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
verify(mockProcessManager.start(
<String>['git', 'show-ref', '--verify', '--quiet', 'refs/heads/stable'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
verify(mockProcessManager.start(
<String>['git', 'checkout', 'stable', '--'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
......
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