mcvsubbu commented on a change in pull request #4306: Added tests for 
RealtimeSegmentValidationManager
URL: https://github.com/apache/incubator-pinot/pull/4306#discussion_r292989952
 
 

 ##########
 File path: 
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/ControllerPeriodicTasksIntegrationTests.java
 ##########
 @@ -499,6 +492,35 @@ public void testOfflineSegmentIntervalChecker()
         115545);
   }
 
+  /**
+   * Group - realtimeSegmentValidationManager - Integration tests for {@link 
org.apache.pinot.controller.validation.RealtimeSegmentValidationManager}
+   * @param context
+   * @throws Exception
+   */
+
+  @Test(groups="realtimeSegmentValidationManager", dependsOnGroups = 
"offlineSegmentIntervalChecker")
+  public void testRealtimeSegmentValidationManager(ITestContext context) 
throws Exception {
+    ControllerMetrics controllerMetrics = 
_controllerStarter.getControllerMetrics();
+    long taskRunCount = 
controllerMetrics.getMeteredTableValue("RealtimeSegmentValidationManager",
+        ControllerMeter.CONTROLLER_PERIODIC_TASK_RUN).count();
+
+    // Wait until the RealtimeSegmentValidationManager runs at least once. 
Most likely it already ran once
+    // on the realtime table (default one) already setup, so we should have 
the total document count on that
+    // realtime table.
+    TestUtils.waitForCondition(input ->
+        
controllerMetrics.getMeteredTableValue("RealtimeSegmentValidationManager", 
ControllerMeter.CONTROLLER_PERIODIC_TASK_RUN)
+            .count() > taskRunCount, 60_000, "Timed out waiting for 
RealtimeSegmentValidationManager to run");
+
+    
Assert.assertTrue(controllerMetrics.getValueOfGlobalGauge(ControllerGauge.PERIODIC_TASK_NUM_TABLES_PROCESSED,
+        "RealtimeSegmentValidationManager") > 0);
+    RealtimeSegmentValidationManager validationManager = 
_controllerStarter.getRealtimeSegmentValidationManager();
+    ValidationMetrics validationMetrics = 
validationManager.getValidationMetrics();
+    // Make sure we processed the realtime table to get the total document 
count. Should have been done the first
+    // time RealtimeSegmentValidationManager ran on the default realtime table.
+    
Assert.assertTrue(validationMetrics.getValueOfGauge(ValidationMetrics.makeGaugeName(getDefaultRealtimeTableName(),
+        "TotalDocumentCount")) > 0);
+  }
+
 
 Review comment:
   Not necessary. We are tearing down the cluster at the end anyway.

----------------------------------------------------------------
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

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

Reply via email to