Skip to content

Commit 7f8d421

Browse files
authored
Fix flaky test (#183)
1 parent 83335f3 commit 7f8d421

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

tests/Integration/OutputNormalizer.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,26 @@ public static function removeIntermediateNonFixedProgressBars(
146146
$itemsCount,
147147
);
148148

149+
// Remove intermediate lines
149150
$output = preg_replace(
150151
'#\s+\d+ \[[->]+?\] .+?MiB\\n#',
151152
'',
152153
$output,
153154
);
154-
155155
$output = preg_replace(
156156
'#\s+\d+ \[[->]+?\] .+?MiB#',
157157
'',
158158
$output,
159159
);
160160

161-
return $restoreFirstLine($restoreLastLine($output));
161+
$output = $restoreFirstLine($restoreLastLine($output));
162+
163+
// Normalize last line
164+
return preg_replace(
165+
'#(\s+'.$itemsCount.' )\[[->]+?\]( .+?MiB)#',
166+
'$1[----->----------------------]$2',
167+
$output,
168+
);
162169
}
163170

164171
/**

tests/Integration/OutputNormalizerTest.php

+20-3
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public static function nonFixedSizedProgressBarsProvider(): iterable
343343
<<<'TXT'
344344
345345
0 [>---------------------------] < 1 sec 8.0 MiB
346-
12 [----------------------------] 142 secs 112.0 MiB
346+
12 [----->----------------------] 142 secs 112.0 MiB
347347

348348
TXT,
349349
];
@@ -363,7 +363,7 @@ public static function nonFixedSizedProgressBarsProvider(): iterable
363363
<<<'TXT'
364364
365365
0 [>---------------------------] < 1 sec 8.0 MiB
366-
12 [>---------------------------] 142 secs 112.0 MiB
366+
12 [----->----------------------] 142 secs 112.0 MiB
367367

368368
TXT,
369369
];
@@ -383,7 +383,7 @@ public static function nonFixedSizedProgressBarsProvider(): iterable
383383
<<<'TXT'
384384
385385
0 [>---------------------------] < 1 sec 8.0 MiB
386-
12 [------------>---------------] 142 secs 112.0 MiB
386+
12 [----->----------------------] 142 secs 112.0 MiB
387387

388388
TXT,
389389
];
@@ -405,6 +405,23 @@ public static function nonFixedSizedProgressBarsProvider(): iterable
405405

406406
TXT,
407407
];
408+
409+
// https://github.com/webmozarts/console-parallelization/actions/runs/3418534317/jobs/5690951308
410+
yield 'final step at a random stage' => [
411+
<<<'TXT'
412+
413+
0 [>---------------------------] 10 secs 10.0 MiB
414+
5 [------->--------------------] 10 secs 10.0 MiB
415+
416+
TXT,
417+
5,
418+
<<<'TXT'
419+
420+
0 [>---------------------------] 10 secs 10.0 MiB
421+
5 [----->----------------------] 10 secs 10.0 MiB
422+
423+
TXT,
424+
];
408425
}
409426

410427
/**

0 commit comments

Comments
 (0)