share a generous test I/O timeout constant
test / unit + widget + golden + a11y (push) Failing after 26s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 23s

The flaky-gate fixes kept hand-tuning magic seconds in each real-I/O
test. Pull them into one Flutter-free constant — ioTimeout (20s) in
test/helpers/timeouts.dart, importable by both the dart-test (pty) and
flutter-test suites — and route the real-external-wait timeouts through
it: PTY output (session + registry), and fs-watcher events (timeout +
poll ceiling). Tune in one place instead of scattering durations.

The ipc socket round-trip timeouts (2s) are left as-is — they haven't
flaked and local sockets respond in ms; they can adopt the constant
later if needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-23 10:41:17 +02:00
co-authored by Claude Opus 4.7
parent b0d5aa36f4
commit 9590f555c9
4 changed files with 31 additions and 15 deletions
+9 -7
View File
@@ -20,6 +20,8 @@ import 'package:clide/src/pty/errors.dart';
import 'package:clide/src/pty/native_pty.dart';
import 'package:test/test.dart';
import '../helpers/timeouts.dart';
void main() {
if (!Platform.isLinux && !Platform.isMacOS) return;
@@ -38,7 +40,7 @@ void main() {
);
addTearDown(s.close);
final got = await _readUntil(s, 'hello-pty', const Duration(seconds: 20));
final got = await _readUntil(s, 'hello-pty', ioTimeout);
expect(got, contains('hello-pty'));
});
@@ -67,13 +69,13 @@ void main() {
addTearDown(sub.cancel);
await firstByte.future.timeout(
const Duration(seconds: 20),
onTimeout: () => fail('shell never produced its first byte within 20s'),
ioTimeout,
onTimeout: () => fail('shell never produced its first byte within ${ioTimeout.inSeconds}s'),
);
s.write(utf8.encode('echo write-test-ok\n'));
final result = await _waitForBuffer(buf, 'write-test-ok', const Duration(seconds: 20));
final result = await _waitForBuffer(buf, 'write-test-ok', ioTimeout);
expect(result, contains('write-test-ok'));
});
@@ -95,8 +97,8 @@ void main() {
await s.close();
await done.future.timeout(
const Duration(seconds: 10),
onTimeout: () => fail('output stream did not close within 10s after s.close()'),
ioTimeout,
onTimeout: () => fail('output stream did not close within ${ioTimeout.inSeconds}s after s.close()'),
);
expect(s.isClosed, isTrue);
});
@@ -116,7 +118,7 @@ void main() {
);
addTearDown(s.close);
final got = await _readUntil(s, 'path-resolution-ok', const Duration(seconds: 20));
final got = await _readUntil(s, 'path-resolution-ok', ioTimeout);
expect(got, contains('path-resolution-ok'));
});