prashantwason commented on a change in pull request #1287: [HUDI-566] Added new 
test cases for class HoodieTimeline, HoodieDefaultTimeline and 
HoodieActiveTimeline.
URL: https://github.com/apache/incubator-hudi/pull/1287#discussion_r373212552
 
 

 ##########
 File path: 
hudi-common/src/test/java/org/apache/hudi/common/table/string/TestHoodieActiveTimeline.java
 ##########
 @@ -164,4 +173,242 @@ public void testTimelineOperations() {
     assertFalse("", activeCommitTimeline.isBeforeTimelineStarts("02"));
     assertTrue("", activeCommitTimeline.isBeforeTimelineStarts("00"));
   }
+
+  @Test
+  public void testTimelineGetOperations() {
+    Vector<HoodieInstant> allInstants = getAllInstants();
+    Supplier<Stream<HoodieInstant>> sup = () -> allInstants.stream();
+    timeline = new HoodieActiveTimeline(metaClient, true);
+    timeline.setInstants(allInstants);
+
+    BiConsumer<HoodieTimeline, Set<String>> checkTimeline = (HoodieTimeline 
timeline, Set<String> actions) -> {
+      sup.get().filter(i -> actions.contains(i.getAction())).forEach(i -> 
assertTrue(timeline.containsInstant(i)));
+      sup.get().filter(i -> !actions.contains(i.getAction())).forEach(i -> 
assertFalse(timeline.containsInstant(i)));
+    };
+
+    // Test that various types of getXXX operations from HoodieActiveTimeline
+    // return the correct set of Instant
+    checkTimeline.accept(timeline.getCommitsTimeline(),
 
 Review comment:
   This is the same way except I have grouped it into a function to reduce the 
number of lines of test code. Each checkTimline.accept(...) call is 2 lines of 
repeated code.
   
   If any of them fails then it is similar to a single junit Assert failing. 
   
   I will added a comment describing the function.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to