Fixing the Flaky Test for org.apache.fluss.client.table.scanner.batch.KvSnapshotBatchScannerITCase.testKvSnapshotLease#2808
Conversation
….KvSnapshotBatchScannerITCase.testKvSnapshotLeas
….KvSnapshotBatchScannerITCase.testKvSnapshotLease timeout fix
| throw new RuntimeException(e); | ||
| } | ||
| } | ||
| return snapshotId; |
There was a problem hiding this comment.
can we use retry() instead of while loop to assert the snapshot id incremental?
There was a problem hiding this comment.
Hi @swuferhong,
As per my analysis
-
Both retry() and waitUntil() throw/fail on timeout. The current while loop returns null on timeout, a fundamentally different semantic. The null return is intentional: the caller triggerAndWaitSnapshot() (line 737) checks for null and calls fail() only if no snapshot was triggered, distinguishing "not triggered" from "legitimately skipped.
-
Also, wrapping retry or waitUntil in try-catch to swallow its failure does not serve the its purpose and is arguably less clear than the current while loop.
A new utility like pollUntil() returning Optional could be added
Purpose
Linked issue: close #2807
Brief change log
File: fluss-server/src/test/java/org/apache/fluss/server/testutils/FlussClusterExtension.java
Tests
API and Format
Documentation