smaheshwar-pltr commented on code in PR #16796:
URL: https://github.com/apache/iceberg/pull/16796#discussion_r3407396224


##########
core/src/test/java/org/apache/iceberg/TestCatalogUtil.java:
##########
@@ -320,6 +325,77 @@ public void noFailureWhenBulkDeletingMetadataFiles() {
         .doesNotThrowAnyException();
   }
 
+  @Test
+  public void deletesSupersededMetadataFileWhenPreviousVersionsMaxIsZero() {
+    FileIO io = mock(FileIO.class);
+
+    TableMetadata.MetadataLogEntry entry1 =
+        new TableMetadata.MetadataLogEntry(
+            System.currentTimeMillis(), "s3://bucket/metadata/v1.json");
+
+    TableMetadata base = mock(TableMetadata.class);
+    TableMetadata metadata = mock(TableMetadata.class);
+
+    when(metadata.propertyAsBoolean(
+            eq(TableProperties.METADATA_DELETE_AFTER_COMMIT_ENABLED), 
anyBoolean()))
+        .thenReturn(true);
+    when(base.previousFiles()).thenReturn(ImmutableList.of(entry1));
+    
when(base.metadataFileLocation()).thenReturn("s3://bucket/metadata/v2.json");
+    when(metadata.previousFiles()).thenReturn(ImmutableList.of());
+    // a freshly built metadata has no location set until it is written, so it 
is null at this point

Review Comment:
   ```suggestion
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to