amogh-jahagirdar commented on code in PR #9134:
URL: https://github.com/apache/iceberg/pull/9134#discussion_r1402637674
##########
core/src/test/java/org/apache/iceberg/TestSnapshotManager.java:
##########
@@ -427,6 +427,26 @@ public void testReplaceBranchNonExistingSourceFails() {
.hasMessage("Ref does not exist: non-existing");
}
+ @Test
+ public void testFastForwardBranchNonExistingSourceBranchFails() {
+ Assertions.assertThatThrownBy(
+ () ->
+ table.manageSnapshots().fastForwardBranch("non-existing",
"other-branch").commit())
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage("Source branch does not exist: non-existing");
+ }
+
+ @Test
+ public void testFastForwardBranchNonExistingTargetFails() {
+ table.newAppend().appendFile(FILE_A).commit();
+ long snapshotId = table.currentSnapshot().snapshotId();
+ table.manageSnapshots().createBranch("branch1", snapshotId).commit();
+ Assertions.assertThatThrownBy(
+ () -> table.manageSnapshots().fastForwardBranch("branch1",
"non-existing").commit())
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage("Ref does not exist: non-existing");
+ }
Review Comment:
I just added these new tests. Technically they were already covered since
replace/fastForward go through the same validation path but wanted test
coverage in case for some reason it changes in the future, this would catch any
issues.
--
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]