You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by ao...@apache.org on 2022/10/19 14:28:55 UTC
[iceberg] branch master updated: Core: Fix flaky test in TestSnapshotUtil (#6015)
This is an automated email from the ASF dual-hosted git repository.
aokolnychyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/master by this push:
new 62eb74c557 Core: Fix flaky test in TestSnapshotUtil (#6015)
62eb74c557 is described below
commit 62eb74c5571c856bae5b32cacb6fb1ec4f380da9
Author: liliwei <hi...@gmail.com>
AuthorDate: Wed Oct 19 22:28:47 2022 +0800
Core: Fix flaky test in TestSnapshotUtil (#6015)
---
core/src/test/java/org/apache/iceberg/util/TestSnapshotUtil.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/core/src/test/java/org/apache/iceberg/util/TestSnapshotUtil.java b/core/src/test/java/org/apache/iceberg/util/TestSnapshotUtil.java
index 20c1034ce6..05c74c3013 100644
--- a/core/src/test/java/org/apache/iceberg/util/TestSnapshotUtil.java
+++ b/core/src/test/java/org/apache/iceberg/util/TestSnapshotUtil.java
@@ -28,6 +28,7 @@ import org.apache.iceberg.DataFiles;
import org.apache.iceberg.PartitionSpec;
import org.apache.iceberg.Schema;
import org.apache.iceberg.Snapshot;
+import org.apache.iceberg.TestHelpers;
import org.apache.iceberg.TestTables;
import org.apache.iceberg.types.Types;
import org.junit.After;
@@ -75,9 +76,11 @@ public class TestSnapshotUtil {
this.table = TestTables.create(tableDir, "test", SCHEMA, SPEC, 2);
table.newFastAppend().appendFile(FILE_A).commit();
- this.snapshotAId = table.currentSnapshot().snapshotId();
+ Snapshot snapshotA = table.currentSnapshot();
+ this.snapshotAId = snapshotA.snapshotId();
+ this.snapshotATimestamp = snapshotA.timestampMillis();
- snapshotATimestamp = System.currentTimeMillis();
+ TestHelpers.waitUntilAfter(snapshotATimestamp);
table.newFastAppend().appendFile(FILE_A).commit();
this.snapshotBId = table.currentSnapshot().snapshotId();
@@ -129,7 +132,7 @@ public class TestSnapshotUtil {
snapshot = SnapshotUtil.oldestAncestorOf(table, snapshotDId);
Assert.assertEquals(snapshotAId, snapshot.snapshotId());
- snapshot = SnapshotUtil.oldestAncestorAfter(table, snapshotATimestamp);
+ snapshot = SnapshotUtil.oldestAncestorAfter(table, snapshotATimestamp + 1);
Assert.assertEquals(snapshotBId, snapshot.snapshotId());
}