You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "anoopj (via GitHub)" <gi...@apache.org> on 2025/07/17 18:42:06 UTC

[PR] Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

anoopj opened a new pull request, #13590:
URL: https://github.com/apache/iceberg/pull/13590

   We have several test cases where we are creating temporary directories/files. Simplify them as JUnit `TempDir` cleans them up automatically. 
   
   Related to https://github.com/apache/iceberg/issues/13506 (I excluded `TestParquetVectorizedReads` so it can be a starter task for someone new). There are more instances of them under `flink` and `spark` - this PR focuses on core and `data`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2218442696


##########
data/src/test/java/org/apache/iceberg/data/avro/TestGenericReadProjection.java:
##########
@@ -34,8 +32,7 @@ public class TestGenericReadProjection extends TestReadProjection {
   @Override
   protected Record writeAndRead(String desc, Schema writeSchema, Schema readSchema, Record record)
       throws IOException {
-    File file = File.createTempFile("junit", ".avro", tempDir);
-    assertThat(file.delete()).isTrue();
+    File file = tempDir.toPath().resolve("junit" + System.nanoTime() + ".avro").toFile();

Review Comment:
   here as well



##########
data/src/test/java/org/apache/iceberg/data/orc/TestGenericReadProjection.java:
##########
@@ -35,8 +33,7 @@ public class TestGenericReadProjection extends TestReadProjection {
   @Override
   protected Record writeAndRead(String desc, Schema writeSchema, Schema readSchema, Record record)
       throws IOException {
-    File file = File.createTempFile("junit", ".orc", tempDir);
-    assertThat(file.delete()).isTrue();
+    File file = tempDir.toPath().resolve("junit" + System.nanoTime() + ".orc").toFile();

Review Comment:
   here as well



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2218443552


##########
data/src/test/java/org/apache/iceberg/data/orc/TestOrcDataWriter.java:
##########
@@ -70,7 +70,8 @@ public void createRecords() {
 
   @Test
   public void testDataWriter() throws IOException {
-    OutputFile file = Files.localOutput(File.createTempFile("junit", null, tempDir));
+    OutputFile file =
+        Files.localOutput(tempDir.toPath().resolve("junit" + System.nanoTime()).toFile());

Review Comment:
   this one also converts from File to Path to File



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2235241325


##########
core/src/test/java/org/apache/iceberg/TestTableMetadata.java:
##########
@@ -1830,8 +1830,7 @@ public void testNoTrailingLocationSlash() {
 
   private String createManifestListWithManifestFile(
       long snapshotId, Long parentSnapshotId, String manifestFile) throws IOException {
-    File manifestList = File.createTempFile("manifests", null, temp.toFile());
-    manifestList.deleteOnExit();
+    File manifestList = temp.resolve("manifests-" + snapshotId + "-" + System.nanoTime()).toFile();

Review Comment:
   ```suggestion
       File manifestList = temp.resolve("manifests-" + System.nanoTime()).toFile();
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "anoopj (via GitHub)" <gi...@apache.org>.
anoopj commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2216595962


##########
core/src/test/java/org/apache/iceberg/TestScanDataFileColumns.java:
##########
@@ -52,9 +50,7 @@ public class TestScanDataFileColumns {
 
   @BeforeEach
   public void createTables() throws IOException {
-    File location = Files.createTempDirectory(temp, "junit").toFile();

Review Comment:
   Done



##########
core/src/test/java/org/apache/iceberg/TestMetadataUpdateParser.java:
##########
@@ -1371,7 +1371,6 @@ private void assertEqualsRemoveEncryptionKey(
   private String createManifestListWithManifestFiles(long snapshotId, Long parentSnapshotId)
       throws IOException {
     File manifestList = File.createTempFile("manifests", null, temp.toFile());

Review Comment:
   Done



##########
core/src/test/java/org/apache/iceberg/TestManifestWriter.java:
##########
@@ -93,8 +93,7 @@ public void testManifestPartitionStats() throws IOException {
   @TestTemplate
   public void testWriteManifestWithSequenceNumber() throws IOException {
     assumeThat(formatVersion).isGreaterThan(1);
-    File manifestFile = File.createTempFile("manifest", ".avro", temp.toFile());

Review Comment:
   @nastra Done. There were many other tests as well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "anoopj (via GitHub)" <gi...@apache.org>.
anoopj commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2234916894


##########
data/src/test/java/org/apache/iceberg/data/TestTableMigrationUtil.java:
##########
@@ -96,8 +96,7 @@ void testListPartitionMissingFilesFailure() {
 
   private static void writePartitionFile(File outputDir) throws IOException {
     Iterable<GenericData.Record> records = RandomAvroData.generate(SCHEMA, 1000, 54310);
-    File testFile = File.createTempFile("junit", ".parquet", outputDir);
-    assertThat(testFile.delete()).as("Delete should succeed").isTrue();
+    File testFile = outputDir.toPath().resolve("junit" + System.nanoTime() + ".parquet").toFile();

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2235016399


##########
data/src/test/java/org/apache/iceberg/data/avro/TestGenericData.java:
##########
@@ -56,8 +54,7 @@ protected void writeAndValidate(Schema writeSchema, Schema expectedSchema) throw
   private void writeAndValidate(Schema writeSchema, Schema expectedSchema, List<Record> expected)
       throws IOException {
 
-    File testFile = File.createTempFile("junit", null, temp.toFile());
-    assertThat(testFile.delete()).isTrue();
+    File testFile = temp.resolve("test-file").toFile();

Review Comment:
   this (and a few other places that do `temp.resolve("test-file").toFile()`) should have a random component just to make sure we use unique files



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "anoopj (via GitHub)" <gi...@apache.org>.
anoopj commented on PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#issuecomment-3125798039

   @nastra Thanks for the thorough review! I believe I have incorporated all of them. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2218437511


##########
data/src/test/java/org/apache/iceberg/data/TestDataFileIndexStatsFilters.java:
##########
@@ -641,6 +641,6 @@ private Pair<DeleteFile, CharSequenceSet> writePosDeletes(
   }
 
   private File createTempFile() throws IOException {

Review Comment:
   looks like we can remove throwing an IOException here now. Could you please also check all the other places that have been adjusted by this PR?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2218442085


##########
data/src/test/java/org/apache/iceberg/data/TestTableMigrationUtil.java:
##########
@@ -96,8 +96,7 @@ void testListPartitionMissingFilesFailure() {
 
   private static void writePartitionFile(File outputDir) throws IOException {
     Iterable<GenericData.Record> records = RandomAvroData.generate(SCHEMA, 1000, 54310);
-    File testFile = File.createTempFile("junit", ".parquet", outputDir);
-    assertThat(testFile.delete()).as("Delete should succeed").isTrue();
+    File testFile = outputDir.toPath().resolve("junit" + System.nanoTime() + ".parquet").toFile();

Review Comment:
   same as I mentioned further above



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2234995052


##########
data/src/test/java/org/apache/iceberg/data/TestLocalScan.java:
##########
@@ -554,8 +552,7 @@ public void testFilterWithDateAndTimestamp() throws IOException {
             required(3, "date", Types.DateType.get()),
             required(4, "time", Types.TimeType.get()));
 
-    File tableLocation = Files.createTempDirectory(tempDir.toPath(), "junit").toFile();
-    assertThat(tableLocation.delete()).isTrue();
+    File tableLocation = new File(tempDir, "junit");

Review Comment:
   all of these need some random part (either UUID or system.nanotime) as in the previous version `junit` was only the prefix of the generated path



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "anoopj (via GitHub)" <gi...@apache.org>.
anoopj commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2234889868


##########
data/src/test/java/org/apache/iceberg/data/TestDataFileIndexStatsFilters.java:
##########
@@ -641,6 +641,6 @@ private Pair<DeleteFile, CharSequenceSet> writePosDeletes(
   }
 
   private File createTempFile() throws IOException {

Review Comment:
   Done. All other places are doing I/O. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#issuecomment-3095638522

   @anoopj can you also please apply the below diff?
   ```
   diff --git a/parquet/src/test/java/org/apache/iceberg/parquet/TestBloomRowGroupFilter.java b/parquet/src/test/java/org/apache/iceberg/parquet/TestBloomRowGroupFilter.java
   index bfa511c912..c98e30d4b3 100644
   --- a/parquet/src/test/java/org/apache/iceberg/parquet/TestBloomRowGroupFilter.java
   +++ b/parquet/src/test/java/org/apache/iceberg/parquet/TestBloomRowGroupFilter.java
   @@ -190,14 +190,12 @@ public class TestBloomRowGroupFilter {
   
      @BeforeEach
      public void createInputFile() throws IOException {
   -
   -    assertThat(temp.delete()).isTrue();
   -
        // build struct field schema
        org.apache.avro.Schema structSchema = AvroSchemaUtil.convert(UNDERSCORE_STRUCT_FIELD_TYPE);
        String compatibleFieldName = "_incompatible_x2Dname";
   
   -    OutputFile outFile = Files.localOutput(temp);
   +    File file = new File(temp, "test" + System.nanoTime());
   +    OutputFile outFile = Files.localOutput(file);
        try (FileAppender<Record> appender =
            Parquet.write(outFile)
                .schema(FILE_SCHEMA)
   @@ -269,7 +267,7 @@ public class TestBloomRowGroupFilter {
          }
        }
   
   -    InputFile inFile = Files.localInput(temp);
   +    InputFile inFile = Files.localInput(file);
   
        ParquetFileReader reader = ParquetFileReader.open(ParquetIO.file(inFile));
   
   diff --git a/parquet/src/test/java/org/apache/iceberg/parquet/TestDictionaryRowGroupFilter.java b/parquet/src/test/java/org/apache/iceberg/parquet/TestDictionaryRowGroupFilter.java
   index fe3e8a402b..df2081aa26 100644
   --- a/parquet/src/test/java/org/apache/iceberg/parquet/TestDictionaryRowGroupFilter.java
   +++ b/parquet/src/test/java/org/apache/iceberg/parquet/TestDictionaryRowGroupFilter.java
   @@ -167,8 +167,7 @@ public class TestDictionaryRowGroupFilter {
   
      @BeforeEach
      public void createInputFile() throws IOException {
   -    File parquetFile = temp.toFile();
   -    assertThat(parquetFile.delete()).isTrue();
   +    File parquetFile = temp.resolve("test" + System.nanoTime() + ".parquet").toFile();
   
        // build struct field schema
        org.apache.avro.Schema structSchema = AvroSchemaUtil.convert(UNDERSCORE_STRUCT_FIELD_TYPE);
   diff --git a/parquet/src/test/java/org/apache/iceberg/parquet/TestParquet.java b/parquet/src/test/java/org/apache/iceberg/parquet/TestParquet.java
   index 5eabeb02d3..15bfb6a2ab 100644
   --- a/parquet/src/test/java/org/apache/iceberg/parquet/TestParquet.java
   +++ b/parquet/src/test/java/org/apache/iceberg/parquet/TestParquet.java
   @@ -190,8 +190,7 @@ public class TestParquet {
                optional(2, "topbytes", Types.BinaryType.get()));
        org.apache.avro.Schema avroSchema = AvroSchemaUtil.convert(schema.asStruct());
   
   -    File testFile = temp.toFile();
   -    assertThat(testFile.delete()).isTrue();
   +    File testFile = temp.resolve("test" + System.nanoTime() + ".parquet").toFile();
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2218438402


##########
core/src/test/java/org/apache/iceberg/hadoop/TestHadoopFileIO.java:
##########
@@ -214,7 +214,7 @@ private static void testJsonParser(HadoopFileIO hadoopFileIO, File tempDir) thro
       // make sure deserialized io can create input file
       Files.createTempDirectory(tempDir.toPath(), "junit");
       deserializedHadoopFileIO.newInputFile(
-          File.createTempFile("test", "parquet", tempDir).toString());
+          tempDir.toPath().resolve("test" + System.nanoTime() + ".parquet").toFile().toString());

Review Comment:
   instead of converting to a Path and then back to a file, this is probably shorter: `new File(tempDir, "test" + System.nanoTime() + ".parquet")`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2214974817


##########
core/src/test/java/org/apache/iceberg/TestScanDataFileColumns.java:
##########
@@ -52,9 +50,7 @@ public class TestScanDataFileColumns {
 
   @BeforeEach
   public void createTables() throws IOException {
-    File location = Files.createTempDirectory(temp, "junit").toFile();

Review Comment:
   can you also please update `TestManifestCaching`?



##########
core/src/test/java/org/apache/iceberg/TestManifestWriter.java:
##########
@@ -93,8 +93,7 @@ public void testManifestPartitionStats() throws IOException {
   @TestTemplate
   public void testWriteManifestWithSequenceNumber() throws IOException {
     assumeThat(formatVersion).isGreaterThan(1);
-    File manifestFile = File.createTempFile("manifest", ".avro", temp.toFile());

Review Comment:
   I see a few more places around core that use the same pattern. Could you please update those as well?
   
   <img width="962" height="528" alt="image" src="https://github.com/user-attachments/assets/9d63742e-ca2e-41bb-bce7-eba58ef8abb0" />
   



##########
core/src/test/java/org/apache/iceberg/TestMetadataUpdateParser.java:
##########
@@ -1371,7 +1371,6 @@ private void assertEqualsRemoveEncryptionKey(
   private String createManifestListWithManifestFiles(long snapshotId, Long parentSnapshotId)
       throws IOException {
     File manifestList = File.createTempFile("manifests", null, temp.toFile());

Review Comment:
   we should also update this one to `File manifestList = temp.resolve("manifests").toFile();` so that we're doing the same thing across the codebase



##########
core/src/test/java/org/apache/iceberg/TestManifestWriter.java:
##########
@@ -93,8 +93,7 @@ public void testManifestPartitionStats() throws IOException {
   @TestTemplate
   public void testWriteManifestWithSequenceNumber() throws IOException {
     assumeThat(formatVersion).isGreaterThan(1);
-    File manifestFile = File.createTempFile("manifest", ".avro", temp.toFile());

Review Comment:
   can you also please update `DeleteReadTests` in `data`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "anoopj (via GitHub)" <gi...@apache.org>.
anoopj commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2234891788


##########
core/src/test/java/org/apache/iceberg/hadoop/TestHadoopFileIO.java:
##########
@@ -214,7 +214,7 @@ private static void testJsonParser(HadoopFileIO hadoopFileIO, File tempDir) thro
       // make sure deserialized io can create input file
       Files.createTempDirectory(tempDir.toPath(), "junit");
       deserializedHadoopFileIO.newInputFile(
-          File.createTempFile("test", "parquet", tempDir).toString());
+          tempDir.toPath().resolve("test" + System.nanoTime() + ".parquet").toFile().toString());

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "anoopj (via GitHub)" <gi...@apache.org>.
anoopj commented on code in PR #13590:
URL: https://github.com/apache/iceberg/pull/13590#discussion_r2235229476


##########
data/src/test/java/org/apache/iceberg/data/avro/TestGenericData.java:
##########
@@ -56,8 +54,7 @@ protected void writeAndValidate(Schema writeSchema, Schema expectedSchema) throw
   private void writeAndValidate(Schema writeSchema, Schema expectedSchema, List<Record> expected)
       throws IOException {
 
-    File testFile = File.createTempFile("junit", null, temp.toFile());
-    assertThat(testFile.delete()).isTrue();
+    File testFile = temp.resolve("test-file").toFile();

Review Comment:
   @nastra Done!



##########
data/src/test/java/org/apache/iceberg/data/TestLocalScan.java:
##########
@@ -554,8 +552,7 @@ public void testFilterWithDateAndTimestamp() throws IOException {
             required(3, "date", Types.DateType.get()),
             required(4, "time", Types.TimeType.get()));
 
-    File tableLocation = Files.createTempDirectory(tempDir.toPath(), "junit").toFile();
-    assertThat(tableLocation.delete()).isTrue();
+    File tableLocation = new File(tempDir, "junit");

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core, Data: Cleanup unit tests by delegating file cleanup to JUnit [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra merged PR #13590:
URL: https://github.com/apache/iceberg/pull/13590


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org