WIP 시험 흔들림: folder_size_test "화면에서 사라진 폴더" - 조건이 될 때까지 실제 시간으로 기다리기 · 한도 2분 (관리자 지시) (검토 대기)
전체 시험 중 PC 가 바쁘면 정해진 횟수 (300 × 10ms) · 고정 시간 (20 · 100ms) 안에 계산이 끝나지 않아 흔들렸다 (11d709a 관리자 확인).
idle 을 실제 시간 (최대 30초) 으로, 고정 기다림은 조건 (읽기 시작 · busy 가 풀림) 으로. 기대값은 그대로.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
review_fix
parent
11d709a97b
commit
02a79839da
|
|
@ -24,12 +24,16 @@ void main() {
|
|||
});
|
||||
tearDown(() => tmp.deleteSync(recursive: true));
|
||||
|
||||
Future<void> idle(FolderSizes s, String path) async {
|
||||
for (var i = 0; i < 300 && s.of(path) == null; i++) {
|
||||
// 관리자 지적 (10/18): 전체 시험 중 PC 가 바쁘면 정해진 횟수 (300 × 10ms) 안에 끝나지 않아 흔들렸다 - 실제 시간으로 (최대 30초) 기다린다
|
||||
Future<void> until(bool Function() ok, {Duration max = const Duration(seconds: 30)}) async {
|
||||
final end = DateTime.now().add(max);
|
||||
while (!ok() && DateTime.now().isBefore(end)) {
|
||||
await Future<void>.delayed(const Duration(milliseconds: 10));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> idle(FolderSizes s, String path) => until(() => s.of(path) != null);
|
||||
|
||||
test('안쪽 폴더까지 합 · 기억 · 바뀌면 그 폴더 · 안쪽 · 위 폴더를 잊음', () async {
|
||||
var reads = 0;
|
||||
final s = FolderSizes(list: (d) {
|
||||
|
|
@ -115,13 +119,14 @@ void main() {
|
|||
final a = p.join(tmp.path, 'a'), b = p.join(tmp.path, 'b');
|
||||
s.request(a, forDir: tmp.path); // 세는 중 (gate 에서 기다림)
|
||||
s.request(b, forDir: tmp.path); // 기다리는 중
|
||||
await Future<void>.delayed(const Duration(milliseconds: 20));
|
||||
await until(() => read.contains('a'));
|
||||
expect(s.busy(a) && s.busy(b), isTrue);
|
||||
// 다른 폴더로 감
|
||||
s.retainAuto([p.join(tmp.path, 'elsewhere')]);
|
||||
expect(s.busy(b), isFalse, reason: '기다리던 것은 빠진다');
|
||||
gate.complete();
|
||||
await Future<void>.delayed(const Duration(milliseconds: 100));
|
||||
await until(() => !s.busy(a));
|
||||
expect(s.busy(a), isFalse);
|
||||
expect(s.of(a), isNull, reason: '세던 것은 멈추고 남기지 않는다');
|
||||
expect(read, isNot(contains('b')));
|
||||
|
||||
|
|
@ -134,11 +139,11 @@ void main() {
|
|||
// [cancel]
|
||||
s.request(a);
|
||||
s.cancel(a);
|
||||
await Future<void>.delayed(const Duration(milliseconds: 100));
|
||||
await until(() => !s.busy(a));
|
||||
expect(s.of(a), isNull);
|
||||
expect(s.busy(a), isFalse);
|
||||
s.dispose();
|
||||
});
|
||||
}, timeout: const Timeout(Duration(minutes: 2)));
|
||||
|
||||
test('크기순 정렬: 아는 폴더는 그 크기로, 모르는 폴더는 가장 작게 (폴더는 늘 위)', () {
|
||||
final now = DateTime(2026);
|
||||
|
|
|
|||
Loading…
Reference in New Issue