ashishkumar50 commented on code in PR #10189:
URL: https://github.com/apache/ozone/pull/10189#discussion_r3224309385
##########
hadoop-ozone/iceberg/src/test/java/org/apache/hadoop/ozone/iceberg/TestRewriteTablePathOzoneAction.java:
##########
@@ -188,6 +191,51 @@ void tablePathRewriteForStartAndEndVersionProvided()
throws Exception {
assertAllInternalPathsRewritten(csvPairs, targetPrefix);
}
+ @Test
+ void statsFileCopyPlanReturnsEmptySetForEmptyStats() {
+ Set<Pair<String, String>> copyPlan =
+ RewriteTablePathOzoneUtils.statsFileCopyPlan(List.of(), List.of());
+
+ assertTrue(copyPlan.isEmpty());
+ }
+
+ @Test
+ void statsFileCopyPlanRejectsMismatchedStatsCount() {
+ IllegalArgumentException exception =
assertThrows(IllegalArgumentException.class,
+ () -> RewriteTablePathOzoneUtils.statsFileCopyPlan(
+ List.of(statisticsFile("before-1.stats", 100)),
+ List.of()));
+
+ assertEquals("Before and after path rewrite, statistic files count should
be same",
+ exception.getMessage());
Review Comment:
Use
`assertThat(exception).hasMessageContaining("Before and after path rewrite,
statistic files count should be same");`
##########
hadoop-ozone/iceberg/src/test/java/org/apache/hadoop/ozone/iceberg/TestRewriteTablePathOzoneAction.java:
##########
@@ -188,6 +191,51 @@ void tablePathRewriteForStartAndEndVersionProvided()
throws Exception {
assertAllInternalPathsRewritten(csvPairs, targetPrefix);
}
+ @Test
+ void statsFileCopyPlanReturnsEmptySetForEmptyStats() {
+ Set<Pair<String, String>> copyPlan =
+ RewriteTablePathOzoneUtils.statsFileCopyPlan(List.of(), List.of());
+
+ assertTrue(copyPlan.isEmpty());
+ }
+
+ @Test
+ void statsFileCopyPlanRejectsMismatchedStatsCount() {
+ IllegalArgumentException exception =
assertThrows(IllegalArgumentException.class,
+ () -> RewriteTablePathOzoneUtils.statsFileCopyPlan(
+ List.of(statisticsFile("before-1.stats", 100)),
+ List.of()));
+
+ assertEquals("Before and after path rewrite, statistic files count should
be same",
+ exception.getMessage());
+ }
+
+ @Test
+ void statsFileCopyPlanRejectsMismatchedStatsFileSize() {
+ IllegalArgumentException exception =
assertThrows(IllegalArgumentException.class,
+ () -> RewriteTablePathOzoneUtils.statsFileCopyPlan(
+ List.of(statisticsFile("before-1.stats", 100)),
+ List.of(statisticsFile("after-1.stats", 200))));
+
+ assertEquals("Before and after path rewrite, statistic files size should
be same",
+ exception.getMessage());
Review Comment:
Use
`assertThat(exception).hasMessageContaining("Before and after path rewrite,
statistic files size should be same");`
--
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]