Skip to content

Commit fa24af4

Browse files
authored
Run integration test once again on temporary failure (#497)
1 parent 6000e94 commit fa24af4

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

tools/lib/src/device.dart

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,23 @@ class Device {
127127
/// nor [PackageResult.exclude].
128128
Future<PackageResult> runIntegrationTest(
129129
Directory workingDir,
130-
Duration timeout,
131-
) async {
130+
Duration timeout, {
131+
bool debug = false,
132+
}) async {
132133
if (!isConnected) {
133134
return PackageResult.fail(
134135
<String>['Device $name ($profile) is not connected.']);
135136
}
136137

137138
final io.Process process = await _processRunner.start(
138139
'flutter-tizen',
139-
<String>['-d', serial!, 'test', 'integration_test'],
140+
<String>[
141+
if (debug) '-v',
142+
'-d',
143+
serial!,
144+
'test',
145+
'integration_test',
146+
],
140147
workingDirectory: workingDir,
141148
);
142149

@@ -393,11 +400,11 @@ class EmulatorDevice extends Device {
393400
@override
394401
Future<PackageResult> runIntegrationTest(
395402
Directory workingDir,
396-
Duration timeout,
397-
) async {
403+
Duration timeout, {
404+
bool debug = false,
405+
}) async {
398406
bool autoLaunched = false;
399407
bool autoCreated = false;
400-
late final PackageResult result;
401408
try {
402409
if (!exists) {
403410
autoCreated = true;
@@ -408,7 +415,7 @@ class EmulatorDevice extends Device {
408415
await launch();
409416
}
410417
_disablePermissionPopups();
411-
result = await super.runIntegrationTest(workingDir, timeout);
418+
return await super.runIntegrationTest(workingDir, timeout, debug: debug);
412419
} finally {
413420
if (autoLaunched) {
414421
await close();
@@ -417,6 +424,5 @@ class EmulatorDevice extends Device {
417424
await delete();
418425
}
419426
}
420-
return result;
421427
}
422428
}

tools/lib/src/integration_test_command.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,13 @@ class IntegrationTestCommand extends PackageLoopingCommand {
224224
}
225225

226226
for (final Device device in devices) {
227-
final PackageResult packageResult = await device.runIntegrationTest(
228-
example.directory,
229-
_timeout,
230-
);
227+
PackageResult packageResult =
228+
await device.runIntegrationTest(example.directory, _timeout);
229+
if (packageResult.state == RunState.failed) {
230+
// Tests may fail unexpectedly on a self-hosted runner. Try again.
231+
packageResult = await device
232+
.runIntegrationTest(example.directory, _timeout, debug: true);
233+
}
231234
if (packageResult.state == RunState.failed) {
232235
errors.addAll(packageResult.details);
233236
}

0 commit comments

Comments
 (0)