jihoonson commented on a change in pull request #6414: Period 
load/drop/broadcast rules should include the future by default
URL: https://github.com/apache/incubator-druid/pull/6414#discussion_r226141985
 
 

 ##########
 File path: 
server/src/test/java/org/apache/druid/server/coordinator/rules/PeriodLoadRuleTest.java
 ##########
 @@ -108,29 +111,61 @@ public void testAppliesToPartialOverlap()
   }
 
   @Test
-  public void testSerdeNullTieredReplicants() throws Exception
+  public void testIncludeFuture()
+  {
+    DateTime now = DateTimes.of("2012-12-31T01:00:00");
+    PeriodLoadRule includeFutureRule = new PeriodLoadRule(
+        new Period("P2D"),
+        true,
+        ImmutableMap.of("", 0)
+    );
+    PeriodLoadRule notIncludeFutureRule = new PeriodLoadRule(
+        new Period("P2D"),
+        false,
+        ImmutableMap.of("", 0)
+    );
+
+    Assert.assertTrue(
+        includeFutureRule.appliesTo(
+            builder.interval(new Interval(now.plusDays(1), 
now.plusDays(2))).build(),
+            now
+        )
+    );
+    Assert.assertFalse(
+        notIncludeFutureRule.appliesTo(
+            builder.interval(new Interval(now.plusDays(1), 
now.plusDays(2))).build(),
+            now
+        )
+    );
+  }
+
+  @Test
+  public void testSerdeNull() throws Exception
   {
     PeriodLoadRule rule = new PeriodLoadRule(
-        new Period("P1D"), null
+        new Period("P1D"), null, null
     );
 
     ObjectMapper jsonMapper = new DefaultObjectMapper();
     Rule reread = jsonMapper.readValue(jsonMapper.writeValueAsString(rule), 
Rule.class);
 
     Assert.assertEquals(rule.getPeriod(), ((PeriodLoadRule) 
reread).getPeriod());
+    Assert.assertEquals(rule.isIncludeFuture(), ((PeriodLoadRule) 
reread).isIncludeFuture());
+    Assert.assertEquals(PeriodLoadRule.DEFAULT_INCLUDE_FUTURE, 
rule.isIncludeFuture());
     Assert.assertEquals(rule.getTieredReplicants(), ((PeriodLoadRule) 
reread).getTieredReplicants());
     Assert.assertEquals(ImmutableMap.of(DruidServer.DEFAULT_TIER, 
DruidServer.DEFAULT_NUM_REPLICANTS), rule.getTieredReplicants());
   }
 
   @Test
-  public void testMappingNullTieredReplicants() throws Exception
+  public void testMappingNull() throws Exception
 
 Review comment:
   Same. Why did you change the name?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to