diff --git a/dev/conductor/core/lib/src/next.dart b/dev/conductor/core/lib/src/next.dart index d06ecba753..9462cbd43c 100644 --- a/dev/conductor/core/lib/src/next.dart +++ b/dev/conductor/core/lib/src/next.dart @@ -160,20 +160,6 @@ class NextContext extends Context { } break; case pb.ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS: - if (state.engine.cherrypicks.isEmpty && state.engine.dartRevision.isEmpty) { - stdio.printStatus( - 'This release has no engine cherrypicks, and thus the engine.version file\n' - 'in the framework does not need to be updated.', - ); - - if (state.framework.cherrypicks.isEmpty) { - stdio.printStatus( - 'This release also has no framework cherrypicks. Therefore, a framework\n' - 'pull request is not required.', - ); - break; - } - } final Remote engineUpstreamRemote = Remote( name: RemoteName.upstream, url: state.engine.upstream.url, diff --git a/dev/conductor/core/test/next_test.dart b/dev/conductor/core/test/next_test.dart index 44ddae273c..f124aa2417 100644 --- a/dev/conductor/core/test/next_test.dart +++ b/dev/conductor/core/test/next_test.dart @@ -425,8 +425,60 @@ void main() { engineRevisionFile.writeAsStringSync(oldEngineVersion, flush: true); }); - test('with no dart, engine or framework cherrypicks, no user input, no PR needed', () async { - state = pb.ConductorState( + test('with no dart, engine or framework cherrypicks, updates engine revision if version mismatch', () async { + stdio.stdin.add('n'); + processManager.addCommands([ + const FakeCommand(command: ['git', 'fetch', 'upstream']), + // we want merged upstream commit, not local working commit + const FakeCommand(command: ['git', 'checkout', 'upstream/$candidateBranch']), + const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + stdout: revision1, + ), + const FakeCommand(command: ['git', 'fetch', 'upstream']), + FakeCommand( + command: const ['git', 'checkout', workingBranch], + onRun: () { + final File file = fileSystem.file('$checkoutsParentDirectory/framework/.ci.yaml') + ..createSync(); + _initializeCiYamlFile(file); + }, + ), + const FakeCommand( + command: ['git', 'status', '--porcelain'], + stdout: 'MM bin/internal/release-candidate-branch.version', + ), + const FakeCommand(command: ['git', 'add', '--all']), + const FakeCommand(command: [ + 'git', + 'commit', + '--message', + 'Create candidate branch version $candidateBranch for $releaseChannel', + ]), + const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + stdout: revision3, + ), + const FakeCommand( + command: ['git', 'status', '--porcelain'], + stdout: 'MM bin/internal/engine.version', + ), + const FakeCommand(command: ['git', 'add', '--all']), + const FakeCommand(command: [ + 'git', + 'commit', + '--message', + 'Update Engine revision to $revision1 for $releaseChannel release $releaseVersion', + ]), + const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + stdout: revision4, + ), + ]); + final pb.ConductorState state = pb.ConductorState( + releaseChannel: releaseChannel, + releaseVersion: releaseVersion, + currentPhase: ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS, framework: pb.Repository( candidateBranch: candidateBranch, checkoutPath: frameworkCheckoutPath, @@ -438,16 +490,14 @@ void main() { candidateBranch: candidateBranch, checkoutPath: engineCheckoutPath, upstream: pb.Remote(name: 'upstream', url: engineUpstreamRemoteUrl), + currentGitHead: revision1, ), - currentPhase: ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS, ); - writeStateToFile( fileSystem.file(stateFile), state, [], ); - final Checkouts checkouts = Checkouts( fileSystem: fileSystem, parentDirectory: fileSystem.directory(checkoutsParentDirectory)..createSync(recursive: true), @@ -456,23 +506,16 @@ void main() { stdio: stdio, ); final CommandRunner runner = createRunner(checkouts: checkouts); - await runner.run([ 'next', '--$kStateOption', stateFile, ]); - final pb.ConductorState finalState = readStateFromFile( - fileSystem.file(stateFile), - ); - - expect(finalState.currentPhase, ReleasePhase.PUBLISH_VERSION); - expect(stdio.error, isEmpty); - expect( - stdio.stdout, - contains('pull request is not required'), - ); + expect(processManager, hasNoRemainingExpectations); + expect(stdio.stdout, contains('release-candidate-branch.version containing $candidateBranch')); + expect(stdio.stdout, contains('Updating engine revision from $oldEngineVersion to $revision1')); + expect(stdio.stdout, contains('Are you ready to push your framework branch')); }); test('with no engine cherrypicks but a dart revision update, updates engine revision', () async {