[flutter_conductor] deprecate increment (#99189)
This commit is contained in:
committed by
GitHub
parent
31316991ee
commit
38dbbb17f8
@@ -5,9 +5,8 @@
|
||||
import 'dart:convert' show jsonDecode;
|
||||
|
||||
import 'package:args/command_runner.dart';
|
||||
import 'package:conductor_core/src/globals.dart';
|
||||
import 'package:conductor_core/src/proto/conductor_state.pb.dart' as pb;
|
||||
import 'package:conductor_core/src/proto/conductor_state.pbenum.dart' show ReleasePhase;
|
||||
import 'package:conductor_core/src/proto/conductor_state.pbenum.dart';
|
||||
import 'package:conductor_core/src/repository.dart';
|
||||
import 'package:conductor_core/src/start.dart';
|
||||
import 'package:conductor_core/src/state.dart';
|
||||
@@ -25,7 +24,7 @@ void main() {
|
||||
const String frameworkMirror = 'https://github.com/user/flutter.git';
|
||||
const String engineMirror = 'https://github.com/user/engine.git';
|
||||
const String candidateBranch = 'flutter-1.2-candidate.3';
|
||||
const String releaseChannel = 'stable';
|
||||
const String releaseChannel = 'beta';
|
||||
const String revision = 'abcd1234';
|
||||
const String conductorVersion = 'deadbeef';
|
||||
late Checkouts checkouts;
|
||||
@@ -97,8 +96,6 @@ void main() {
|
||||
'beta',
|
||||
'--$kStateOption',
|
||||
'/path/to/statefile.json',
|
||||
'--$kIncrementOption',
|
||||
'y',
|
||||
]),
|
||||
throwsExceptionWith(
|
||||
'Error! This tool is only supported on macOS and Linux',
|
||||
@@ -124,186 +121,32 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('does not fail if version wrong but --force provided', () async {
|
||||
const String revision2 = 'def789';
|
||||
const String revision3 = '123abc';
|
||||
const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef';
|
||||
const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e';
|
||||
const String previousVersion = '1.2.0-1.0.pre';
|
||||
// This is what this release will be
|
||||
const String nextVersion = '1.2.0-1.1.pre';
|
||||
const String incrementLevel = 'n';
|
||||
|
||||
final Directory engine = fileSystem
|
||||
.directory(checkoutsParentDirectory)
|
||||
.childDirectory('flutter_conductor_checkouts')
|
||||
.childDirectory('engine');
|
||||
|
||||
final File depsFile = engine.childFile('DEPS');
|
||||
|
||||
final List<FakeCommand> engineCommands = <FakeCommand>[
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
'git',
|
||||
'clone',
|
||||
'--origin',
|
||||
'upstream',
|
||||
'--',
|
||||
EngineRepository.defaultUpstream,
|
||||
engine.path,
|
||||
],
|
||||
onRun: () {
|
||||
// Create the DEPS file which the tool will update
|
||||
engine.createSync(recursive: true);
|
||||
depsFile.writeAsStringSync(generateMockDeps(previousDartRevision));
|
||||
}),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'remote', 'add', 'mirror', engineMirror],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'fetch', 'mirror'],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision2,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'git',
|
||||
'checkout',
|
||||
'-b',
|
||||
'cherrypicks-$candidateBranch',
|
||||
],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'status', '--porcelain'],
|
||||
stdout: 'MM path/to/DEPS',
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'add', '--all'],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'commit', "--message='Update Dart SDK to $nextDartRevision'"],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision2,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision2,
|
||||
),
|
||||
];
|
||||
|
||||
final List<FakeCommand> frameworkCommands = <FakeCommand>[
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
'git',
|
||||
'clone',
|
||||
'--origin',
|
||||
'upstream',
|
||||
'--',
|
||||
FrameworkRepository.defaultUpstream,
|
||||
fileSystem.path.join(
|
||||
checkoutsParentDirectory,
|
||||
'flutter_conductor_checkouts',
|
||||
'framework',
|
||||
),
|
||||
],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'remote', 'add', 'mirror', frameworkMirror],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'fetch', 'mirror'],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision3,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'git',
|
||||
'checkout',
|
||||
'-b',
|
||||
'cherrypicks-$candidateBranch',
|
||||
],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'git',
|
||||
'describe',
|
||||
'--match',
|
||||
'*.*.*',
|
||||
'--tags',
|
||||
'refs/remotes/upstream/$candidateBranch',
|
||||
],
|
||||
stdout: '$previousVersion-42-gabc123',
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision3,
|
||||
),
|
||||
];
|
||||
|
||||
final CommandRunner<void> runner = createRunner(
|
||||
commands: <FakeCommand>[
|
||||
...engineCommands,
|
||||
...frameworkCommands,
|
||||
],
|
||||
);
|
||||
test('throws if provided an invalid --$kVersionOverrideOption', () async {
|
||||
final CommandRunner<void> runner = createRunner();
|
||||
|
||||
final String stateFilePath = fileSystem.path.join(
|
||||
platform.environment['HOME']!,
|
||||
kStateFileName,
|
||||
);
|
||||
|
||||
await runner.run(<String>[
|
||||
'start',
|
||||
'--$kFrameworkMirrorOption',
|
||||
frameworkMirror,
|
||||
'--$kEngineMirrorOption',
|
||||
engineMirror,
|
||||
'--$kCandidateOption',
|
||||
candidateBranch,
|
||||
'--$kReleaseOption',
|
||||
releaseChannel,
|
||||
'--$kStateOption',
|
||||
stateFilePath,
|
||||
'--$kDartRevisionOption',
|
||||
nextDartRevision,
|
||||
'--$kIncrementOption',
|
||||
incrementLevel,
|
||||
'--$kForceFlag',
|
||||
]);
|
||||
|
||||
final File stateFile = fileSystem.file(stateFilePath);
|
||||
|
||||
final pb.ConductorState state = pb.ConductorState();
|
||||
state.mergeFromProto3Json(
|
||||
jsonDecode(stateFile.readAsStringSync()),
|
||||
await expectLater(
|
||||
() async => runner.run(<String>[
|
||||
'start',
|
||||
'--$kFrameworkMirrorOption',
|
||||
frameworkMirror,
|
||||
'--$kEngineMirrorOption',
|
||||
engineMirror,
|
||||
'--$kCandidateOption',
|
||||
candidateBranch,
|
||||
'--$kReleaseOption',
|
||||
releaseChannel,
|
||||
'--$kStateOption',
|
||||
stateFilePath,
|
||||
'--$kVersionOverrideOption',
|
||||
'an invalid version string',
|
||||
]),
|
||||
throwsExceptionWith('an invalid version string cannot be parsed'),
|
||||
);
|
||||
|
||||
expect(processManager.hasRemainingExpectations, false);
|
||||
expect(state.isInitialized(), true);
|
||||
expect(state.releaseChannel, releaseChannel);
|
||||
expect(state.releaseVersion, nextVersion);
|
||||
expect(state.engine.candidateBranch, candidateBranch);
|
||||
expect(state.engine.startingGitHead, revision2);
|
||||
expect(state.engine.dartRevision, nextDartRevision);
|
||||
expect(state.engine.upstream.url, 'git@github.com:flutter/engine.git');
|
||||
expect(state.framework.candidateBranch, candidateBranch);
|
||||
expect(state.framework.startingGitHead, revision3);
|
||||
expect(state.framework.upstream.url, 'git@github.com:flutter/flutter.git');
|
||||
expect(state.currentPhase, ReleasePhase.APPLY_ENGINE_CHERRYPICKS);
|
||||
expect(state.conductorVersion, conductorVersion);
|
||||
expect(state.incrementLevel, incrementLevel);
|
||||
});
|
||||
|
||||
test('creates state file if provided correct inputs', () async {
|
||||
@@ -313,11 +156,9 @@ void main() {
|
||||
const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef';
|
||||
const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e';
|
||||
const String previousVersion = '1.2.0-1.0.pre';
|
||||
// This is a git tag applied to the branch point, not an actual release
|
||||
const String branchPointTag = '1.2.0-3.0.pre';
|
||||
// This is what this release will be
|
||||
const String nextVersion = '1.2.0-3.1.pre';
|
||||
const String incrementLevel = 'm';
|
||||
const String nextVersion = '1.2.0-1.1.pre';
|
||||
const String candidateBranch = 'flutter-1.2-candidate.1';
|
||||
|
||||
final Directory engine = fileSystem
|
||||
.directory(checkoutsParentDirectory)
|
||||
@@ -431,25 +272,17 @@ void main() {
|
||||
],
|
||||
stdout: '$previousVersion-42-gabc123',
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision3,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'merge-base', candidateBranch, 'master'],
|
||||
stdout: branchPointRevision,
|
||||
),
|
||||
// check if commit is tagged
|
||||
// check if commit is tagged, zero exit code means it is tagged
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'describe', '--exact-match', '--tags', branchPointRevision],
|
||||
// non-zero exit means commit is not tagged
|
||||
exitCode: 128,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'tag', branchPointTag, branchPointRevision],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'push', FrameworkRepository.defaultUpstream, branchPointTag],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision3,
|
||||
),
|
||||
];
|
||||
|
||||
@@ -479,8 +312,6 @@ void main() {
|
||||
stateFilePath,
|
||||
'--$kDartRevisionOption',
|
||||
nextDartRevision,
|
||||
'--$kIncrementOption',
|
||||
incrementLevel,
|
||||
]);
|
||||
|
||||
final File stateFile = fileSystem.file(stateFilePath);
|
||||
@@ -490,7 +321,9 @@ void main() {
|
||||
jsonDecode(stateFile.readAsStringSync()),
|
||||
);
|
||||
|
||||
expect(processManager.hasRemainingExpectations, false);
|
||||
expect(state.releaseType, ReleaseType.BETA_HOTFIX);
|
||||
expect(stdio.error, isNot(contains('Tried to tag the branch point, however the target version')));
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
expect(state.isInitialized(), true);
|
||||
expect(state.releaseChannel, releaseChannel);
|
||||
expect(state.releaseVersion, nextVersion);
|
||||
@@ -503,10 +336,179 @@ void main() {
|
||||
expect(state.framework.upstream.url, 'git@github.com:flutter/flutter.git');
|
||||
expect(state.currentPhase, ReleasePhase.APPLY_ENGINE_CHERRYPICKS);
|
||||
expect(state.conductorVersion, conductorVersion);
|
||||
expect(state.incrementLevel, incrementLevel);
|
||||
expect(stdio.stdout, contains('Applying the tag $branchPointTag at the branch point $branchPointRevision'));
|
||||
expect(stdio.stdout, contains('The actual release will be version $nextVersion'));
|
||||
expect(branchPointTag != nextVersion, true);
|
||||
});
|
||||
|
||||
test('uses --$kVersionOverrideOption', () async {
|
||||
stdio.stdin.add('y'); // accept prompt from ensureBranchPointTagged()
|
||||
const String revision2 = 'def789';
|
||||
const String revision3 = '123abc';
|
||||
const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef';
|
||||
const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e';
|
||||
const String previousVersion = '1.2.0-1.0.pre';
|
||||
const String candidateBranch = 'flutter-1.2-candidate.1';
|
||||
const String versionOverride = '42.0.0-42.0.pre';
|
||||
|
||||
final Directory engine = fileSystem
|
||||
.directory(checkoutsParentDirectory)
|
||||
.childDirectory('flutter_conductor_checkouts')
|
||||
.childDirectory('engine');
|
||||
|
||||
final File depsFile = engine.childFile('DEPS');
|
||||
|
||||
final List<FakeCommand> engineCommands = <FakeCommand>[
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
'git',
|
||||
'clone',
|
||||
'--origin',
|
||||
'upstream',
|
||||
'--',
|
||||
EngineRepository.defaultUpstream,
|
||||
engine.path,
|
||||
],
|
||||
onRun: () {
|
||||
// Create the DEPS file which the tool will update
|
||||
engine.createSync(recursive: true);
|
||||
depsFile.writeAsStringSync(generateMockDeps(previousDartRevision));
|
||||
}),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'remote', 'add', 'mirror', engineMirror],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'fetch', 'mirror'],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision2,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'git',
|
||||
'checkout',
|
||||
'-b',
|
||||
'cherrypicks-$candidateBranch',
|
||||
],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'status', '--porcelain'],
|
||||
stdout: 'MM path/to/DEPS',
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'add', '--all'],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'commit', "--message='Update Dart SDK to $nextDartRevision'"],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision2,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision2,
|
||||
),
|
||||
];
|
||||
|
||||
final List<FakeCommand> frameworkCommands = <FakeCommand>[
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
'git',
|
||||
'clone',
|
||||
'--origin',
|
||||
'upstream',
|
||||
'--',
|
||||
FrameworkRepository.defaultUpstream,
|
||||
fileSystem.path.join(
|
||||
checkoutsParentDirectory,
|
||||
'flutter_conductor_checkouts',
|
||||
'framework',
|
||||
),
|
||||
],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'remote', 'add', 'mirror', frameworkMirror],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'fetch', 'mirror'],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision3,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'git',
|
||||
'checkout',
|
||||
'-b',
|
||||
'cherrypicks-$candidateBranch',
|
||||
],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'git',
|
||||
'describe',
|
||||
'--match',
|
||||
'*.*.*',
|
||||
'--tags',
|
||||
'refs/remotes/upstream/$candidateBranch',
|
||||
],
|
||||
stdout: '$previousVersion-42-gabc123',
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision3,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'merge-base', candidateBranch, 'master'],
|
||||
stdout: branchPointRevision,
|
||||
),
|
||||
];
|
||||
|
||||
final CommandRunner<void> runner = createRunner(
|
||||
commands: <FakeCommand>[
|
||||
...engineCommands,
|
||||
...frameworkCommands,
|
||||
],
|
||||
);
|
||||
|
||||
final String stateFilePath = fileSystem.path.join(
|
||||
platform.environment['HOME']!,
|
||||
kStateFileName,
|
||||
);
|
||||
|
||||
await runner.run(<String>[
|
||||
'start',
|
||||
'--$kFrameworkMirrorOption',
|
||||
frameworkMirror,
|
||||
'--$kEngineMirrorOption',
|
||||
engineMirror,
|
||||
'--$kCandidateOption',
|
||||
candidateBranch,
|
||||
'--$kReleaseOption',
|
||||
releaseChannel,
|
||||
'--$kStateOption',
|
||||
stateFilePath,
|
||||
'--$kDartRevisionOption',
|
||||
nextDartRevision,
|
||||
'--$kVersionOverrideOption',
|
||||
versionOverride,
|
||||
]);
|
||||
|
||||
final File stateFile = fileSystem.file(stateFilePath);
|
||||
|
||||
final pb.ConductorState state = pb.ConductorState();
|
||||
state.mergeFromProto3Json(
|
||||
jsonDecode(stateFile.readAsStringSync()),
|
||||
);
|
||||
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
expect(state.releaseVersion, versionOverride);
|
||||
});
|
||||
|
||||
test('logs to STDERR but does not fail on an unexpected candidate branch', () async {
|
||||
@@ -517,11 +519,8 @@ void main() {
|
||||
const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e';
|
||||
// note that this significantly behind the candidate branch name
|
||||
const String previousVersion = '0.9.0-1.0.pre';
|
||||
// This is a git tag applied to the branch point, not an actual release
|
||||
const String branchPointTag = '1.2.0-3.0.pre';
|
||||
// This is what this release will be
|
||||
const String nextVersion = '1.2.0-3.1.pre';
|
||||
const String incrementLevel = 'm';
|
||||
const String nextVersion = '0.9.0-1.1.pre';
|
||||
|
||||
final Directory engine = fileSystem
|
||||
.directory(checkoutsParentDirectory)
|
||||
@@ -635,25 +634,17 @@ void main() {
|
||||
],
|
||||
stdout: '$previousVersion-42-gabc123',
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision3,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'merge-base', candidateBranch, 'master'],
|
||||
stdout: branchPointRevision,
|
||||
),
|
||||
// check if commit is tagged
|
||||
// check if commit is tagged, 0 exit code means it is tagged
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'describe', '--exact-match', '--tags', branchPointRevision],
|
||||
// non-zero exit means commit is not tagged
|
||||
exitCode: 128,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'tag', branchPointTag, branchPointRevision],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'push', FrameworkRepository.defaultUpstream, branchPointTag],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision3,
|
||||
),
|
||||
];
|
||||
|
||||
@@ -683,8 +674,6 @@ void main() {
|
||||
stateFilePath,
|
||||
'--$kDartRevisionOption',
|
||||
nextDartRevision,
|
||||
'--$kIncrementOption',
|
||||
incrementLevel,
|
||||
]);
|
||||
|
||||
final File stateFile = fileSystem.file(stateFilePath);
|
||||
@@ -694,7 +683,8 @@ void main() {
|
||||
jsonDecode(stateFile.readAsStringSync()),
|
||||
);
|
||||
|
||||
expect(processManager.hasRemainingExpectations, false);
|
||||
expect(stdio.error, isNot(contains('Tried to tag the branch point, however')));
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
expect(state.isInitialized(), true);
|
||||
expect(state.releaseChannel, releaseChannel);
|
||||
expect(state.releaseVersion, nextVersion);
|
||||
@@ -707,10 +697,7 @@ void main() {
|
||||
expect(state.framework.upstream.url, 'git@github.com:flutter/flutter.git');
|
||||
expect(state.currentPhase, ReleasePhase.APPLY_ENGINE_CHERRYPICKS);
|
||||
expect(state.conductorVersion, conductorVersion);
|
||||
expect(state.incrementLevel, incrementLevel);
|
||||
expect(stdio.stdout, contains('Applying the tag $branchPointTag at the branch point $branchPointRevision'));
|
||||
expect(stdio.stdout, contains('The actual release will be version $nextVersion'));
|
||||
expect(branchPointTag != nextVersion, true);
|
||||
expect(state.releaseType, ReleaseType.BETA_HOTFIX);
|
||||
expect(stdio.error, contains('Parsed version $previousVersion.42 has a different x value than candidate branch $candidateBranch'));
|
||||
});
|
||||
|
||||
@@ -721,7 +708,6 @@ void main() {
|
||||
const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e';
|
||||
const String previousVersion = '1.2.0-3.0.pre';
|
||||
const String nextVersion = '1.2.0';
|
||||
const String incrementLevel = 'z';
|
||||
|
||||
final Directory engine = fileSystem
|
||||
.directory(checkoutsParentDirectory)
|
||||
@@ -835,6 +821,10 @@ void main() {
|
||||
],
|
||||
stdout: '$previousVersion-42-gabc123',
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision3,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'merge-base', candidateBranch, 'master'],
|
||||
stdout: branchPointRevision,
|
||||
@@ -843,10 +833,6 @@ void main() {
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'describe', '--exact-match', '--tags', branchPointRevision],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision3,
|
||||
),
|
||||
];
|
||||
|
||||
final CommandRunner<void> runner = createRunner(
|
||||
@@ -870,13 +856,11 @@ void main() {
|
||||
'--$kCandidateOption',
|
||||
candidateBranch,
|
||||
'--$kReleaseOption',
|
||||
releaseChannel,
|
||||
'stable',
|
||||
'--$kStateOption',
|
||||
stateFilePath,
|
||||
'--$kDartRevisionOption',
|
||||
nextDartRevision,
|
||||
'--$kIncrementOption',
|
||||
incrementLevel,
|
||||
]);
|
||||
|
||||
final File stateFile = fileSystem.file(stateFilePath);
|
||||
@@ -888,7 +872,7 @@ void main() {
|
||||
|
||||
expect(processManager.hasRemainingExpectations, false);
|
||||
expect(state.isInitialized(), true);
|
||||
expect(state.releaseChannel, releaseChannel);
|
||||
expect(state.releaseChannel, 'stable');
|
||||
expect(state.releaseVersion, nextVersion);
|
||||
expect(state.engine.candidateBranch, candidateBranch);
|
||||
expect(state.engine.startingGitHead, revision2);
|
||||
@@ -897,7 +881,7 @@ void main() {
|
||||
expect(state.framework.startingGitHead, revision3);
|
||||
expect(state.currentPhase, ReleasePhase.APPLY_ENGINE_CHERRYPICKS);
|
||||
expect(state.conductorVersion, conductorVersion);
|
||||
expect(state.incrementLevel, incrementLevel);
|
||||
expect(state.releaseType, ReleaseType.STABLE_INITIAL);
|
||||
});
|
||||
|
||||
test('StartContext gets engine and framework checkout directories after run', () async {
|
||||
@@ -910,8 +894,6 @@ void main() {
|
||||
const String previousVersion = '1.2.0-1.0.pre';
|
||||
// This is a git tag applied to the branch point, not an actual release
|
||||
const String branchPointTag = '1.2.0-3.0.pre';
|
||||
// This is what this release will be
|
||||
const String incrementLevel = 'm';
|
||||
|
||||
final Directory engine = fileSystem
|
||||
.directory(checkoutsParentDirectory)
|
||||
@@ -1026,6 +1008,11 @@ void main() {
|
||||
],
|
||||
stdout: '$previousVersion-42-gabc123',
|
||||
),
|
||||
// HEAD and branch point are same
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: branchPointRevision,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'merge-base', candidateBranch, 'master'],
|
||||
stdout: branchPointRevision,
|
||||
@@ -1042,10 +1029,6 @@ void main() {
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'push', FrameworkRepository.defaultUpstream, branchPointTag],
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'rev-parse', 'HEAD'],
|
||||
stdout: revision3,
|
||||
),
|
||||
];
|
||||
|
||||
final String operatingSystem = const LocalPlatform().operatingSystem;
|
||||
@@ -1081,25 +1064,32 @@ void main() {
|
||||
);
|
||||
|
||||
final StartContext startContext = StartContext(
|
||||
candidateBranch: candidateBranch,
|
||||
checkouts: checkouts,
|
||||
dartRevision: nextDartRevision,
|
||||
engineCherrypickRevisions: <String>[],
|
||||
engineMirror: engineMirror,
|
||||
engineUpstream: EngineRepository.defaultUpstream,
|
||||
frameworkCherrypickRevisions: <String>[],
|
||||
frameworkMirror: frameworkMirror,
|
||||
frameworkUpstream: FrameworkRepository.defaultUpstream,
|
||||
releaseChannel: releaseChannel,
|
||||
incrementLetter: incrementLevel,
|
||||
processManager: processManager,
|
||||
conductorVersion: conductorVersion,
|
||||
stateFile: stateFile);
|
||||
candidateBranch: candidateBranch,
|
||||
checkouts: checkouts,
|
||||
dartRevision: nextDartRevision,
|
||||
engineCherrypickRevisions: <String>[],
|
||||
engineMirror: engineMirror,
|
||||
engineUpstream: EngineRepository.defaultUpstream,
|
||||
frameworkCherrypickRevisions: <String>[],
|
||||
frameworkMirror: frameworkMirror,
|
||||
frameworkUpstream: FrameworkRepository.defaultUpstream,
|
||||
releaseChannel: releaseChannel,
|
||||
processManager: processManager,
|
||||
conductorVersion: conductorVersion,
|
||||
stateFile: stateFile,
|
||||
);
|
||||
|
||||
await startContext.run();
|
||||
|
||||
final pb.ConductorState state = pb.ConductorState();
|
||||
state.mergeFromProto3Json(
|
||||
jsonDecode(stateFile.readAsStringSync()),
|
||||
);
|
||||
|
||||
expect((await startContext.engine.checkoutDirectory).path, equals(engine.path));
|
||||
expect((await startContext.framework.checkoutDirectory).path, equals(framework.path));
|
||||
expect(state.releaseType, ReleaseType.BETA_INITIAL);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
});
|
||||
}, onPlatform: <String, dynamic>{
|
||||
'windows': const Skip('Flutter Conductor only supported on macos/linux'),
|
||||
|
||||
@@ -18,7 +18,6 @@ void main() {
|
||||
final pb.ConductorState state = pb.ConductorState(
|
||||
releaseChannel: 'stable',
|
||||
releaseVersion: '2.3.4',
|
||||
incrementLevel: 'z',
|
||||
engine: pb.Repository(
|
||||
candidateBranch: candidateBranch,
|
||||
upstream: pb.Remote(
|
||||
@@ -60,8 +59,7 @@ void main() {
|
||||
},
|
||||
"logs": [
|
||||
"[status] hello world"
|
||||
],
|
||||
"incrementLevel": "z"
|
||||
]
|
||||
}''';
|
||||
expect(serializedState, expectedString);
|
||||
});
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:conductor_core/src/proto/conductor_state.pbenum.dart';
|
||||
import 'package:conductor_core/src/version.dart';
|
||||
|
||||
import './common.dart';
|
||||
import 'common.dart';
|
||||
|
||||
void main() {
|
||||
group('Version.fromString()', () {
|
||||
@@ -106,7 +107,7 @@ void main() {
|
||||
const String candidateBranch = 'flutter-3.2-candidate.4';
|
||||
final Version version = Version.fromString(versionString);
|
||||
expect(
|
||||
() => version.ensureValid(candidateBranch, 'n'),
|
||||
() => version.ensureValid(candidateBranch, ReleaseType.BETA_HOTFIX),
|
||||
throwsExceptionWith(
|
||||
'Parsed version $versionString has a different x value than '
|
||||
'candidate branch $candidateBranch',
|
||||
@@ -119,7 +120,7 @@ void main() {
|
||||
const String candidateBranch = 'flutter-1.15-candidate.4';
|
||||
final Version version = Version.fromString(versionString);
|
||||
expect(
|
||||
() => version.ensureValid(candidateBranch, 'm'),
|
||||
() => version.ensureValid(candidateBranch, ReleaseType.BETA_INITIAL),
|
||||
throwsExceptionWith(
|
||||
'Parsed version $versionString has a different y value than '
|
||||
'candidate branch $candidateBranch',
|
||||
@@ -132,7 +133,7 @@ void main() {
|
||||
const String candidateBranch = 'flutter-1.2-candidate.0';
|
||||
final Version version = Version.fromString(versionString);
|
||||
expect(
|
||||
() => version.ensureValid(candidateBranch, 'n'),
|
||||
() => version.ensureValid(candidateBranch, ReleaseType.BETA_HOTFIX),
|
||||
throwsExceptionWith(
|
||||
'Parsed version $versionString has a different m value than '
|
||||
'candidate branch $candidateBranch',
|
||||
@@ -145,7 +146,7 @@ void main() {
|
||||
const String candidateBranch = 'flutter-1.2-candidate.98';
|
||||
final Version version = Version.fromString(versionString);
|
||||
expect(
|
||||
() => version.ensureValid(candidateBranch, 'n'),
|
||||
() => version.ensureValid(candidateBranch, ReleaseType.STABLE_HOTFIX),
|
||||
isNot(throwsException),
|
||||
);
|
||||
});
|
||||
@@ -155,21 +156,11 @@ void main() {
|
||||
const String candidateBranch = 'stable';
|
||||
final Version version = Version.fromString(versionString);
|
||||
expect(
|
||||
() => version.ensureValid(candidateBranch, 'z'),
|
||||
() => version.ensureValid(candidateBranch, ReleaseType.STABLE_HOTFIX),
|
||||
throwsExceptionWith(
|
||||
'Candidate branch $candidateBranch does not match the pattern',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('does not validate m if incrementLetter is m', () {
|
||||
const String versionString = '1.2.0-0.0.pre';
|
||||
const String candidateBranch = 'flutter-1.2-candidate.42';
|
||||
final Version version = Version.fromString(versionString);
|
||||
expect(
|
||||
() => version.ensureValid(candidateBranch, 'm'),
|
||||
isNot(throwsException),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user