parakhnr commented on code in PR #2489:
URL: https://github.com/apache/helix/pull/2489#discussion_r1197066374
##########
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:
We have log level of `ERROR` enabled, which means no `INFO` logs will be
shown when we run the test. I intentionally used `sys.out` so that they show up
in the CI logs.
--
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]