Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions pkg/pub_integration/lib/src/fake_pub_server_process.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'dart:io';
import 'dart:math';

import 'package:path/path.dart' as p;
import 'package:retry/retry.dart';

final _random = Random.secure();

Expand Down Expand Up @@ -100,12 +101,22 @@ class FakePubServerProcess {

await lockFile.create();
try {
final pr1 =
await Process.run('dart', ['pub', 'get'], workingDirectory: appDir);
if (pr1.exitCode != 0) {
throw Exception(
'dart pub get failed in app\n${pr1.stdout}\n${pr1.stderr}');
}
await retry(
maxAttempts: 2,
retryIf: (e) => e is TimeoutException,
() async {
final pr1 = await Process.run(
'dart',
['pub', 'get'],
workingDirectory: appDir,
).timeout(Duration(seconds: 15));

if (pr1.exitCode != 0) {
throw Exception(
'dart pub get failed in app\n${pr1.stdout}\n${pr1.stderr}');
}
},
);
} finally {
await lockFile.delete();
}
Expand Down
20 changes: 17 additions & 3 deletions pkg/pub_integration/lib/src/test_browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:_pub_shared/validation/html/html_validation.dart';
import 'package:path/path.dart' as p;
import 'package:puppeteer/puppeteer.dart';
import 'package:retry/retry.dart';

import 'screenshot_utils.dart';

Expand Down Expand Up @@ -49,10 +51,19 @@ class TestBrowser {
];

for (final binary in binaries) {
if (File(binary).existsSync()) {
if (!File(binary).existsSync()) {
continue;
}
try {
// Get the local chrome's main version
final pr = await Process.run(binary, ['--version'])
.timeout(Duration(seconds: 5));
final pr = await retry(
maxAttempts: 2,
retryIf: (e) => e is TimeoutException,
() async {
return await Process.run(binary, ['--version'])
.timeout(Duration(seconds: 5));
},
);
final output = pr.stdout.toString();
final mainVersion = output
.split(' ')
Expand All @@ -67,6 +78,9 @@ class TestBrowser {
if (mainVersion >= 132) continue;

return binary;
} on TimeoutException catch (_) {
print('Unable to detect chrome version with $binary');
continue;
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/pub_integration/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies:
path: ^1.8.0
pub_semver: ^2.0.0
puppeteer: 3.16.0
retry: ^3.1.2
oauth2: ^2.0.0

dev_dependencies:
Expand Down