From 1a685e03a20df39c668556683d202ed18870f13f Mon Sep 17 00:00:00 2001 From: Christopher Fujino Date: Thu, 2 Apr 2020 10:35:30 -0700 Subject: [PATCH] Improve downgrade-upgrade integration test (#53775) --- .../downgrade_upgrade_integration_test.dart | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/flutter_tools/test/integration.shard/downgrade_upgrade_integration_test.dart b/packages/flutter_tools/test/integration.shard/downgrade_upgrade_integration_test.dart index 353cfb87d0..1e42316fd7 100644 --- a/packages/flutter_tools/test/integration.shard/downgrade_upgrade_integration_test.dart +++ b/packages/flutter_tools/test/integration.shard/downgrade_upgrade_integration_test.dart @@ -12,8 +12,8 @@ import 'package:process/process.dart'; import '../src/common.dart'; -const String _kInitialVersion = 'v1.9.1+hotfix.6'; -const String _kBranch = 'stable'; +const String _kInitialVersion = 'v1.9.1'; +const String _kBranch = 'dev'; const FileSystem fileSystem = LocalFileSystem(); const ProcessManager processManager = LocalProcessManager(); final Stdio stdio = Stdio(); @@ -50,20 +50,23 @@ void main() { final Directory testDirectory = parentDirectory.childDirectory('flutter'); testDirectory.createSync(recursive: true); + int exitCode = 0; + // Enable longpaths for windows integration test. await processManager.run([ 'git', 'config', '--system', 'core.longpaths', 'true', ]); // Step 1. Clone the dev branch of flutter into the test directory. - await processUtils.stream([ + exitCode = await processUtils.stream([ 'git', 'clone', 'https://github.com/flutter/flutter.git', ], workingDirectory: parentDirectory.path, trace: true); + expect(exitCode, 0); // Step 2. Switch to the dev branch. - await processUtils.stream([ + exitCode = await processUtils.stream([ 'git', 'checkout', '--track', @@ -71,22 +74,26 @@ void main() { _kBranch, 'origin/$_kBranch', ], workingDirectory: testDirectory.path, trace: true); + expect(exitCode, 0); // Step 3. Revert to a prior version. - await processUtils.stream([ + exitCode = await processUtils.stream([ 'git', 'reset', '--hard', _kInitialVersion, ], workingDirectory: testDirectory.path, trace: true); + expect(exitCode, 0); // Step 4. Upgrade to the newest dev. This should update the persistent // tool state with the sha for v1.14.3 - await processUtils.stream([ + exitCode = await processUtils.stream([ flutterBin, 'upgrade', + '--verbose', '--working-directory=${testDirectory.path}' ], workingDirectory: testDirectory.path, trace: true); + expect(exitCode, 0); // Step 5. Verify that the version is different. final RunResult versionResult = await processUtils.run([ @@ -101,12 +108,13 @@ void main() { expect(versionResult.stdout, isNot(contains(_kInitialVersion))); // Step 6. Downgrade back to initial version. - await processUtils.stream([ + exitCode = await processUtils.stream([ flutterBin, 'downgrade', '--no-prompt', '--working-directory=${testDirectory.path}' ], workingDirectory: testDirectory.path, trace: true); + expect(exitCode, 0); // Step 7. Verify downgraded version matches original version. final RunResult oldVersionResult = await processUtils.run([