Skip to content

Commit

Permalink
Spark: Flaky test due temp directory (#10811)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuzhang authored Oct 28, 2024
1 parent 7ac617a commit 47eac52
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.nio.file.NoSuchFileException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import org.apache.avro.generic.GenericData.Record;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.iceberg.Files;
import org.apache.iceberg.Parameter;
Expand Down Expand Up @@ -419,5 +421,13 @@ public void testFaultToleranceOnWrite() throws IOException {

assertThat(snapshotBeforeFailingWrite).isEqualTo(snapshotAfterFailingWrite);
assertThat(resultBeforeFailingWrite).isEqualTo(resultAfterFailingWrite);

while (location.exists()) {
try {
FileUtils.deleteDirectory(location);
} catch (NoSuchFileException e) {
// ignore NoSuchFileException when a file is already deleted
}
}
}
}

0 comments on commit 47eac52

Please sign in to comment.