fix: e2e tests (#2259)

This commit is contained in:
Erick
2024-06-18 14:15:41 -03:00
committed by GitHub
parent fb164688d4
commit 4400b0e1db
3 changed files with 22 additions and 8 deletions
+3 -1
View File
@@ -144,5 +144,7 @@ jobs:
cache: true
- name: 🧪 Run Integration Tests
run: dart test integration_test
# 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
working-directory: packages/shorebird_cli
@@ -24,13 +24,21 @@ R runWithOverrides<R>(R Function() body) {
void main() {
group('shorebird cache', () {
test('can clear the cache', () {
final result = runCommand(
'shorebird cache clear',
workingDirectory: '.',
);
group('clear', () {
tearDown(() {
// Run an arbritery, fast command, so cache will be restored
// for the next test.
runCommand('--version', workingDirectory: '.');
});
expect(result.exitCode, equals(ExitCode.success.code));
test('can clear the cache', () {
final result = runCommand(
'shorebird cache clear',
workingDirectory: '.',
);
expect(result.exitCode, equals(ExitCode.success.code));
});
});
});
}
@@ -32,11 +32,15 @@ R runWithOverrides<R>(R Function() body) {
}
void main() {
final shorebirdHostedURL = Platform.environment['SHOREBIRD_HOSTED_URL'];
if (shorebirdHostedURL == null || shorebirdHostedURL.isEmpty) {
throw Exception('SHOREBIRD_HOSTED_URL environment variable is not set.');
}
final logger = Logger();
final client = runWithOverrides(
() => CodePushClient(
httpClient: Auth().client,
hostedUri: Uri.parse(Platform.environment['SHOREBIRD_HOSTED_URL']!),
hostedUri: Uri.parse(shorebirdHostedURL),
),
);