From 38f53e70ccd3c232ea04bfcedf04ac7e7368d6ba Mon Sep 17 00:00:00 2001 From: RyuJongJin <266630912+RyuJongJin@users.noreply.github.com> Date: Sun, 18 Oct 2026 03:00:02 +0900 Subject: [PATCH] =?UTF-8?q?WIP=20=EC=8B=9C=ED=97=98=20=ED=9D=94=EB=93=A4?= =?UTF-8?q?=EB=A6=BC:=20sftp=5Fexplorer=5Ftest=20=EB=8A=94=20=EC=8B=A4?= =?UTF-8?q?=EC=A0=9C=20=EC=8B=9C=EA=B0=84=EC=9C=BC=EB=A1=9C=20=EA=B8=B0?= =?UTF-8?q?=EB=8B=A4=EB=A6=AC=EA=B3=A0=20=EC=8B=9C=ED=97=98=20=EC=84=9C?= =?UTF-8?q?=EB=B2=84=EB=8A=94=20=ED=8F=AC=ED=8A=B8=EA=B0=80=20=EB=B0=9B?= =?UTF-8?q?=EB=8A=94=20=EA=B2=83=EC=9D=84=20=EB=B3=B8=20=EB=92=A4=20?= =?UTF-8?q?=EC=8B=9C=EC=9E=91=20(=EA=B2=80=ED=86=A0=20=EB=8C=80=EA=B8=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 관리자 지적 (10/18): "처음 연결: 지문 안내 → … → 지문은 설정에 저장" 이 전체 시험 (wt_mgr 00e9685) 에서만 실패. 시험 서버 (paramiko) 는 PORT 를 찍기 전에 listen 하므로, 무거울 때 걸리는 것은 settle 의 횟수 (300번 ≈ 10~15초) 였다 - 키 교환이 그보다 오래 걸림. - settle: 횟수 대신 실제 시간 (처음 90초) 까지 조건을 기다린다. - SftpTestServer.start: PORT · FINGERPRINT 줄을 기다리는 시간을 정하고 (60 · 30초, 서버가 죽으면 끝없이 기다리지 않게), 포트가 연결을 받는 것을 본 뒤 돌려준다. 시험: sftp_explorer · sftp_stream · sftp_test 10 통과. Co-Authored-By: Claude Opus 5.5 --- test/sftp_explorer_test.dart | 6 ++++-- test/support/sftp_server.dart | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/test/sftp_explorer_test.dart b/test/sftp_explorer_test.dart index 7bf9115..82a6dee 100644 --- a/test/sftp_explorer_test.dart +++ b/test/sftp_explorer_test.dart @@ -32,8 +32,10 @@ void main() { } }); - Future settle(WidgetTester tester, bool Function() done, {int rounds = 300}) async { - for (var i = 0; i < rounds; i++) { + // 횟수가 아니라 실제 시간으로 기다린다 (전체 시험이 함께 돌아 무거우면 paramiko 서버의 키 교환이 몇십 초 걸린다 - 관리자 지적 10/18) + Future settle(WidgetTester tester, bool Function() done, {Duration limit = const Duration(seconds: 90)}) async { + final end = DateTime.now().add(limit); + while (DateTime.now().isBefore(end)) { await tester.runAsync(() => Future.delayed(const Duration(milliseconds: 30))); await tester.pump(); if (done()) break; diff --git a/test/support/sftp_server.dart b/test/support/sftp_server.dart index bacde6d..c852208 100644 --- a/test/support/sftp_server.dart +++ b/test/support/sftp_server.dart @@ -41,8 +41,19 @@ class SftpTestServer { ]); final lines = pr.stdout.transform(utf8.decoder).transform(const LineSplitter()).asBroadcastStream(); pr.stderr.drain(); - final port = int.parse((await lines.firstWhere((l) => l.startsWith('PORT '))).split(' ')[1]); - final fp = (await lines.firstWhere((l) => l.startsWith('FINGERPRINT '))).split(' ')[1]; + final port = int.parse((await lines.firstWhere((l) => l.startsWith('PORT ')).timeout(const Duration(seconds: 60))).split(' ')[1]); + final fp = (await lines.firstWhere((l) => l.startsWith('FINGERPRINT ')).timeout(const Duration(seconds: 30))).split(' ')[1]; + // 무거울 때도 포트가 연결을 받는 것을 본 뒤에 시작한다 (관리자 지적 10/18) + final end = DateTime.now().add(const Duration(seconds: 30)); + while (true) { + try { + (await Socket.connect('127.0.0.1', port, timeout: const Duration(seconds: 2))).destroy(); + break; + } on SocketException { + if (DateTime.now().isAfter(end)) rethrow; + await Future.delayed(const Duration(milliseconds: 200)); + } + } return SftpTestServer._(pr, port, fp); }