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
7 changes: 2 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@ jobs:
FLUTTER: flutter
SUITES: dart
QLOGDIR: ${{ runner.temp }}/qlog/dart
# DEBUG -v: flutter test once launched the app and then waited 13 minutes without connecting to it; verbose
# output shows what it waits on.
run: ./run_integration_tests.sh ios "${{ steps.simulator.outputs.udid }}" -v
run: ./run_integration_tests.sh ios "${{ steps.simulator.outputs.udid }}"
- name: Upload logs
if: always()
timeout-minutes: 2
Expand Down Expand Up @@ -354,8 +352,7 @@ jobs:
env:
FLUTTER: flutter
SUITES: dart
# DEBUG -v: shows what flutter test waits on when it doesn't connect to the app (see Record logcat).
run: ./run_integration_tests.sh android emulator-5554 -v
run: ./run_integration_tests.sh android emulator-5554
# Runs after a failed Dart suite too, but not when the emulator never came up.
- name: Native bridge tests (instrumented)
if: ${{ !cancelled() && steps.emulator.outcome == 'success' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ class CronetBridgeTest {
))
}

// Each case opens a fresh connection to the host through the emulator, which once took 3 s to come up on CI (the
// request reached the server just as a 3 s wait gave up). 10 s, like the Dart cases, still fails a real hang fast.
private fun await(callId: Int, vararg types: String): Map<String, Any?> {
val deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(3)
val deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(10)
while (true) {
events.firstOrNull { it["callId"] == callId && it["type"] in types }?.let { return it }
val left = deadline - System.nanoTime()
Expand Down
31 changes: 23 additions & 8 deletions example/integration_test/eliza_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,34 @@ void main() {
// on the same CI runner are both slow (a QUIC connection took 66 ms to set up, and the server answered its first
// packet 130 ms after it was sent), so the first call's QUIC attempt loses URLSession's race to TCP. The cases then
// start on a warm app and server. The protocol it got is logged, not checked.
//
// A few attempts, each on a fresh client whose call a deadline cancels: on a freshly booted simulator, trustd can
// stall every certificate check for a while (once while it updated its pinning database from a trust data update).
// Three 8 s attempts stay inside the test framework's 30 s default timeout.
setUpAll(() async {
if (serverUrl.isEmpty) {
return; // setUp reports it.
}
final warmup = await Harness.create(serverUrl, http3Origins: {Uri.parse(serverUrl)});
try {
await warmup.eliza
.say(SayRequest(sentence: 'warm up'), onHeader: warmup.recordHeaders)
.timeout(const Duration(seconds: 10));
debugPrint('warm-up call went over ${warmup.serverProtocols.single}');
} finally {
await warmup.native.close();
const attempts = 3;
final errors = <Object>[];
for (var attempt = 1; attempt <= attempts; attempt++) {
final warmup = await Harness.create(serverUrl, http3Origins: {Uri.parse(serverUrl)});
try {
await warmup.eliza.say(
SayRequest(sentence: 'warm up'),
signal: TimeoutSignal(const Duration(seconds: 8)),
onHeader: warmup.recordHeaders,
);
debugPrint('warm-up call $attempt went over ${warmup.serverProtocols.single}');
return;
} on ConnectException catch (e) {
debugPrint('warm-up call $attempt failed: $e');
errors.add(e);
} finally {
await warmup.native.close();
}
}
fail('no warm-up call succeeded in $attempts attempts: $errors');
});

setUp(() async {
Expand Down
Loading