rahulrane50 commented on code in PR #2489:
URL: https://github.com/apache/helix/pull/2489#discussion_r1197037519
##########
helix-core/src/test/java/org/apache/helix/monitoring/TestClusterStatusMonitorLifecycle.java:
##########
@@ -164,46 +136,41 @@ public void beforeClass() throws Exception {
@AfterClass
public void afterClass() throws Exception {
System.out.println("Cleaning up...");
- for (int i = 0; i < 2 * n; i++) {
- if (_controllers[i] != null) {
- _controllers[i].syncStop();
- }
- }
for (MockParticipantManager participant : _participants) {
if (participant != null) {
participant.syncStop();
}
}
- cleanupControllers();
deleteCluster(_controllerClusterName);
for (String cluster : _clusters) {
TestHelper.dropCluster(cluster, _gZkClient);
}
System.out.println("END " + _clusterNamePrefix + " at " + new
Date(System.currentTimeMillis()));
- // restoring error level for helix logs
- updateLog4jLevel(ERROR, HELIX_LOGGER_NAME);
- }
-
- private void cleanupControllers() {
- for (ClusterDistributedController controller : _controllers) {
- controller.syncStop();
- }
}
/**
- * Updates the log level for the specified logger.
- * @param level Log level to update.
- * @param loggerName Name of the logger for which the level will be updated.
+ * Disconnects all the controllers one by one.
+ * NOTE: Invoking this method multiple times won't disconnect the
controllers multiple times.
*/
- private void updateLog4jLevel(org.apache.logging.log4j.Level level, String
loggerName) {
- LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
- Configuration config = ctx.getConfiguration();
- LoggerConfig loggerConfig =
-
config.getLoggerConfig(String.valueOf(LogManager.getLogger(loggerName)));
- loggerConfig.setLevel(level);
- ctx.updateLoggers();
+ private void cleanupControllers() {
+ for (int i = 0; i < n; i++) {
+ ClusterDistributedController controller = _controllers[i];
+ if (controller != null) {
+ ZkHelixClusterVerifier controllerClusterVerifier =
+ new
BestPossibleExternalViewVerifier.Builder(controller.getClusterName()).setZkClient(
+
_gZkClient).setWaitTillVerify(TestHelper.DEFAULT_REBALANCE_PROCESSING_WAIT_TIME)
+ .build();
+ Assert.assertTrue(controllerClusterVerifier.verifyByPolling(),
+ "Controller cluster NOT in ideal state");
+ System.out.println(String.format("Disconnecting controller %s from
cluster %s at %s",
Review Comment:
is this println intentional or we can replace it with log message?
##########
helix-core/src/test/java/org/apache/helix/monitoring/TestClusterStatusMonitorLifecycle.java:
##########
@@ -164,46 +136,41 @@ public void beforeClass() throws Exception {
@AfterClass
public void afterClass() throws Exception {
System.out.println("Cleaning up...");
- for (int i = 0; i < 2 * n; i++) {
- if (_controllers[i] != null) {
- _controllers[i].syncStop();
- }
- }
for (MockParticipantManager participant : _participants) {
if (participant != null) {
participant.syncStop();
}
}
- cleanupControllers();
Review Comment:
Umm why are we removing this? We still want to remove all controllers at the
end of this test case right?
--
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]