rdblue commented on code in PR #19031:
URL: https://github.com/apache/iceberg/pull/19031#discussion_r4634357255


##########
core/src/test/java/org/apache/iceberg/TestRemoveSnapshotsV4.java:
##########
@@ -58,7 +57,7 @@ void 
rejectsFileCleanupWithRootManifestSnapshot(ExpireSnapshots.CleanupLevel cle
             () ->
                 table
                     .expireSnapshots()
-                    .expireOlderThan(FAR_FUTURE_MS)
+                    .expireOlderThan(table.currentSnapshot().timestampMillis() 
+ 1)

Review Comment:
   @huaxingao, thanks for reviewing this PR as well.
   
   In general, this is a much better approach when writing tests. We should 
never guess how long a test will take. That makes it flaky, even if it seems 
like it will always pass.
   
   You never know when you'll hit an abnormal GC or have a process paused. You 
also don't know when the test is repurposed later. We have quite a few tests 
that have been extended to also test Spark actions. If we did that with this 
test, it's not at all hard to imagine a long pause between class initialization 
(that sets `FAR_FUTURE_MS`) and the test actually running.
   
   Please watch out for these cases during review. We should never commit tests 
that make guesses like this when it is so easy to write a test that uses a 
value that is known to be correct like this.



-- 
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