This is an automated email from the ASF dual-hosted git repository.
etudenhoefner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/main by this push:
new 3747965e9d Core: Use `@TempDir` in TestTableMetadataParser (#14732)
3747965e9d is described below
commit 3747965e9d750cdf0cba65e5367a75dbc3d132e1
Author: Yuya Ebihara <[email protected]>
AuthorDate: Tue Dec 2 15:11:25 2025 +0900
Core: Use `@TempDir` in TestTableMetadataParser (#14732)
---
.../java/org/apache/iceberg/TestTableMetadataParser.java | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/core/src/test/java/org/apache/iceberg/TestTableMetadataParser.java
b/core/src/test/java/org/apache/iceberg/TestTableMetadataParser.java
index 87c618b9ad..45333a4dde 100644
--- a/core/src/test/java/org/apache/iceberg/TestTableMetadataParser.java
+++ b/core/src/test/java/org/apache/iceberg/TestTableMetadataParser.java
@@ -29,7 +29,6 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -39,9 +38,9 @@ import org.apache.iceberg.TableMetadataParser.Codec;
import org.apache.iceberg.io.OutputFile;
import org.apache.iceberg.relocated.com.google.common.collect.Maps;
import org.apache.iceberg.types.Types.BooleanType;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.io.TempDir;
@ExtendWith(ParameterizedTestExtension.class)
public class TestTableMetadataParser {
@@ -56,10 +55,10 @@ public class TestTableMetadataParser {
@Parameter private String codecName;
@TestTemplate
- public void testGzipCompressionProperty() throws IOException {
+ public void testGzipCompressionProperty(@TempDir Path tempDir) throws
IOException {
Codec codec = Codec.fromName(codecName);
String fileExtension = getFileExtension(codec);
- String fileName = "v3" + fileExtension;
+ String fileName = tempDir + "/v3" + fileExtension;
OutputFile outputFile = Files.localOutput(fileName);
Map<String, String> properties = Maps.newHashMap();
properties.put(TableProperties.METADATA_COMPRESSION, codecName);
@@ -71,13 +70,6 @@ public class TestTableMetadataParser {
verifyMetadata(metadata, actualMetadata);
}
- @AfterEach
- public void cleanup() throws IOException {
- Codec codec = Codec.fromName(codecName);
- Path metadataFilePath = Paths.get("v3" + getFileExtension(codec));
- java.nio.file.Files.deleteIfExists(metadataFilePath);
- }
-
private void verifyMetadata(TableMetadata expected, TableMetadata actual) {
assertThat(actual.schema().asStruct()).isEqualTo(expected.schema().asStruct());
assertThat(actual.location()).isEqualTo(expected.location());