Avoid flaky tests with parallel execution

One test stores and deletes files named "-saved.xls", so
we need to prevent other tests from reading those

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1899077 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2022-03-20 08:20:05 +00:00
parent 9949242022
commit 42985f64df
2 changed files with 9 additions and 0 deletions

View File

@ -136,6 +136,7 @@ public class TestAllFiles {
final List<Arguments> result = new ArrayList<>(100);
for (String file : scanner.getIncludedFiles()) {
// avoid running on files leftover from previous failed runs
// or being created by tests run in parallel
if(file.endsWith("-saved.xls") || file.endsWith("TestHPSFWritingFunctionality.doc")) {
continue;
}

View File

@ -91,6 +91,14 @@ public abstract class BaseTestIteratingXLS {
@ParameterizedTest
@MethodSource("files")
void testMain(File file, Class<? extends Throwable> t) throws Exception {
// avoid running files leftover from previous failed runs
// or created by tests running in parallel
// otherwise this would cause sporadic failures with
// parallel test execution
if(file.getName().endsWith("-saved.xls")) {
return;
}
Executable ex = () -> runOneFile(file);
if (t == null) {
assertDoesNotThrow(ex);