RussellSpitzer commented on code in PR #18477:
URL: https://github.com/apache/iceberg/pull/18477#discussion_r4518665230
##########
spark/v4.2/spark/src/test/java/org/apache/iceberg/spark/actions/TestExpireSnapshotsAction.java:
##########
@@ -1416,4 +1420,125 @@ public void testCleanExpiredMetadata() {
.contains(FILE_A.location())
.doesNotContain(fileInNewSpec.location());
}
+
+ @TestTemplate
+ public void
testExpireWithMissingManifestListReachableOnlyFromExpiredSnapshots() {
+ assertExpireSkipsMissingMetadata(Snapshot::manifestListLocation);
+ }
+
+ @TestTemplate
+ public void testExpireWithMissingManifestReachableOnlyFromExpiredSnapshots()
{
+ assertExpireSkipsMissingMetadata(
+ snapshot ->
Iterables.getOnlyElement(snapshot.allManifests(table.io())).path());
+ }
+
+ private void assertExpireSkipsMissingMetadata(
Review Comment:
It took me a minute to follow this helper. The function is only used to pick
which of the first snapshot's files to delete, so the key input of each test is
hidden behind a lambda.
We can probably make this a lot clearer by only extracting the common part
and keeping what makes each test unique part of the test itself. For example
```java
@TestTemplate
public void expireSkipsMissingManifestList() {
Snapshot firstSnapshot = commitSnapshotsForSkipTest();
table.io().deleteFile(firstSnapshot.manifestListLocation());
assertExpireSkipsMissingMetadata();
}
```
```java
@TestTemplate
public void expireSkipsMissingManifest() {
Snapshot firstSnapshot = commitSnapshotsForSkipTest();
table.io().deleteFile(
Iterables.getOnlyElement(firstSnapshot.allManifests(table.io())).path());
assertExpireSkipsMissingMetadata();
}
```
--
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]