chore: revert flaky cache clear integration test

This commit is contained in:
Felix Angelov
2024-06-19 15:29:30 -05:00
parent 966e804872
commit e7bb5a7bcb
4 changed files with 22 additions and 73 deletions
+1 -3
View File
@@ -144,7 +144,5 @@ jobs:
cache: true
- name: 🧪 Run Integration Tests
# Run a single test at a time to ensure that one test does not interfere with another
# since some commands might change the state of the cli installation.
run: dart test integration_test -j 1
run: dart test integration_test
working-directory: packages/shorebird_cli
@@ -1,24 +0,0 @@
import 'dart:io';
import 'package:mason_logger/mason_logger.dart';
/// Helper function to run a command in the shell, meant to be used in tests.
///
/// It will take a command string, like `shorebird --version`, run it in the
/// shell, and return the result.
ProcessResult runCommand(
String command, {
required String workingDirectory,
Logger? logger,
}) {
final parts = command.split(' ');
final executable = parts.first;
final arguments = parts.skip(1).toList();
(logger ?? Logger()).info('running $command in $workingDirectory');
return Process.runSync(
executable,
arguments,
runInShell: true,
workingDirectory: workingDirectory,
);
}
@@ -1,44 +0,0 @@
import 'package:mason_logger/mason_logger.dart';
import 'package:scoped_deps/scoped_deps.dart';
import 'package:shorebird_cli/src/auth/auth.dart';
import 'package:shorebird_cli/src/http_client/http_client.dart';
import 'package:shorebird_cli/src/logger.dart';
import 'package:shorebird_cli/src/platform.dart';
import 'package:shorebird_cli/src/shorebird_env.dart';
import 'package:test/test.dart';
import 'helpers.dart';
R runWithOverrides<R>(R Function() body) {
return runScoped(
body,
values: {
authRef,
httpClientRef,
loggerRef,
platformRef,
shorebirdEnvRef,
},
);
}
void main() {
group('shorebird cache', () {
group('clear', () {
tearDown(() {
// Run an arbritery, fast command, so cache will be restored
// for the next test.
runCommand('--version', workingDirectory: '.');
});
test('can clear the cache', () {
final result = runCommand(
'shorebird cache clear',
workingDirectory: '.',
);
expect(result.exitCode, equals(ExitCode.success.code));
});
});
});
}
@@ -16,8 +16,6 @@ import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
import 'package:test/test.dart';
import 'package:uuid/uuid.dart';
import 'helpers.dart';
R runWithOverrides<R>(R Function() body) {
return runScoped(
body,
@@ -44,6 +42,27 @@ void main() {
),
);
/// Helper function to run a command in the shell, meant to be used in tests.
///
/// It will take a command string, like `shorebird --version`, run it in the
/// shell, and return the result.
ProcessResult runCommand(
String command, {
required String workingDirectory,
Logger? logger,
}) {
final parts = command.split(' ');
final executable = parts.first;
final arguments = parts.skip(1).toList();
(logger ?? Logger()).info('running $command in $workingDirectory');
return Process.runSync(
executable,
arguments,
runInShell: true,
workingDirectory: workingDirectory,
);
}
test('--version', () {
final result = runCommand('shorebird --version', workingDirectory: '.');
expect(result.stderr, isEmpty);