Skip to content

Commit

Permalink
[ci] Re-enable Windows repo tool tests (flutter#4007)
Browse files Browse the repository at this point in the history
Fixes publish test to always expect the command being run to be 'flutter', since it uses a mock platform that reports as Linux.

Fixes flutter#126750
  • Loading branch information
stuartmorgan authored May 17, 2023
1 parent eabaacc commit 2b38236
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
1 change: 0 additions & 1 deletion .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ targets:
]
- name: Windows repo_tools_tests
bringup: true # https://github.com/flutter/flutter/issues/126750
recipe: packages/packages
timeout: 30
properties:
Expand Down
22 changes: 8 additions & 14 deletions script/tool/test/publish_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ import 'package:flutter_plugin_tools/src/publish_command.dart';
import 'package:http/http.dart' as http;
import 'package:http/testing.dart';
import 'package:mockito/mockito.dart';
import 'package:platform/platform.dart';
import 'package:test/test.dart';

import 'common/package_command_test.mocks.dart';
import 'mocks.dart';
import 'util.dart';

void main() {
final String flutterCommand = getFlutterCommand(const LocalPlatform());

late MockPlatform platform;
late Directory packagesDir;
late MockGitDir gitDir;
Expand Down Expand Up @@ -149,8 +146,7 @@ void main() {
createFakePlugin('plugin1', packagesDir, examples: <String>[]);
createFakePlugin('plugin2', packagesDir, examples: <String>[]);

processRunner.mockProcessesForExecutable[flutterCommand] =
<FakeProcessInfo>[
processRunner.mockProcessesForExecutable['flutter'] = <FakeProcessInfo>[
FakeProcessInfo(
MockProcess(
stdout: 'Foo',
Expand Down Expand Up @@ -206,7 +202,7 @@ void main() {
expect(
processRunner.recordedCalls,
contains(ProcessCall(
flutterCommand,
'flutter',
const <String>['pub', 'publish', '--dry-run', '--server=bar'],
plugin.path)));
});
Expand All @@ -229,7 +225,7 @@ void main() {
expect(
processRunner.recordedCalls,
contains(ProcessCall(
flutterCommand,
'flutter',
const <String>['pub', 'publish', '--server=bar', '--force'],
plugin.path)));
});
Expand All @@ -253,11 +249,11 @@ void main() {
processRunner.recordedCalls,
containsAllInOrder(<ProcessCall>[
ProcessCall(
flutterCommand,
'flutter',
const <String>['pub', 'publish', '--server=bar', '--force'],
plugin1.path),
ProcessCall(
flutterCommand,
'flutter',
const <String>['pub', 'publish', '--server=bar', '--force'],
plugin2.path),
]));
Expand Down Expand Up @@ -285,8 +281,7 @@ void main() {
test('throws if pub publish fails', () async {
createFakePlugin('foo', packagesDir, examples: <String>[]);

processRunner.mockProcessesForExecutable[flutterCommand] =
<FakeProcessInfo>[
processRunner.mockProcessesForExecutable['flutter'] = <FakeProcessInfo>[
FakeProcessInfo(MockProcess(exitCode: 128), <String>['pub', 'publish'])
];

Expand Down Expand Up @@ -371,8 +366,7 @@ void main() {
test('only if publishing succeeded', () async {
createFakePlugin('foo', packagesDir, examples: <String>[]);

processRunner.mockProcessesForExecutable[flutterCommand] =
<FakeProcessInfo>[
processRunner.mockProcessesForExecutable['flutter'] = <FakeProcessInfo>[
FakeProcessInfo(MockProcess(exitCode: 128), <String>['pub', 'publish']),
];

Expand Down Expand Up @@ -954,7 +948,7 @@ class TestProcessRunner extends RecordingProcessRunner {
{Directory? workingDirectory}) async {
final io.Process process =
await super.start(executable, args, workingDirectory: workingDirectory);
if (executable == getFlutterCommand(const LocalPlatform()) &&
if (executable == 'flutter' &&
args.isNotEmpty &&
args[0] == 'pub' &&
args[1] == 'publish') {
Expand Down

0 comments on commit 2b38236

Please sign in to comment.