mcvsubbu commented on a change in pull request #4047: Create
leadControllerResource in helix cluster
URL: https://github.com/apache/incubator-pinot/pull/4047#discussion_r290035491
##########
File path:
pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManagerTest.java
##########
@@ -458,6 +472,96 @@ public void testValidateTenantConfigs() {
}
}
+ @Test
+ public void testLeadControllerResource() {
+ IdealState leadControllerResourceIdealState =
_helixResourceManager.getLeadControllerResourceIdealState();
+ Assert.assertTrue(leadControllerResourceIdealState.isValid());
+ Assert.assertTrue(leadControllerResourceIdealState.isEnabled());
+ Assert.assertEquals(leadControllerResourceIdealState.getInstanceGroupTag(),
+ CommonConstants.Helix.CONTROLLER_INSTANCE_TYPE);
+ Assert.assertEquals(leadControllerResourceIdealState.getNumPartitions(),
+
CommonConstants.Helix.NUMBER_OF_PARTITIONS_IN_LEAD_CONTROLLER_RESOURCE);
+ Assert.assertEquals(leadControllerResourceIdealState.getReplicas(), "1");
+ Assert.assertEquals(leadControllerResourceIdealState.getRebalanceMode(),
IdealState.RebalanceMode.FULL_AUTO);
+ Assert.assertTrue(leadControllerResourceIdealState
+
.getInstanceSet(leadControllerResourceIdealState.getPartitionSet().iterator().next()).isEmpty());
+
+ ExternalView leadControllerResourceExternalView =
_helixResourceManager.getLeadControllerResourceExternalView();
+ for (String partition :
leadControllerResourceExternalView.getPartitionSet()) {
+ Map<String, String> stateMap =
leadControllerResourceExternalView.getStateMap(partition);
+ Assert.assertEquals(stateMap.size(), 1);
+ Map.Entry<String, String> entry = stateMap.entrySet().iterator().next();
+ Assert.assertEquals(entry.getKey(), PREFIX_OF_CONTROLLER_INSTANCE +
LOCAL_HOST + "_" + _controllerPort);
+ Assert.assertEquals(entry.getValue(), "MASTER");
+ }
+ }
+
+ @Test
+ public void testLeadControllerAssignment() {
+ // Given a list of instances (from 1 to 10), make sure all the instances
got assigned to lead controller resource.
+ for (int nInstances = 1; nInstances <= 10; nInstances++) {
Review comment:
Please use static final int for 10 so we know it is number of controller
instances.
----------------------------------------------------------------
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]