private void blackListTT(TTClient client) throws Exception { Configuration tConf= client.getProxy().getDaemonConf(); tConf.set("mapred.task.tracker.report.address", cluster.getConf().get("mapred.task.tracker.report.address")); String defaultHealthScript = tConf.get("mapred.healthChecker.script.path"); Assert.assertTrue("Health script was not set", defaultHealthScript != null); tConf.set("mapred.healthChecker.script.path", remotePath+File.separator+ TestHealthScriptError.healthScriptError); tConf.setInt("mapred.healthChecker.interval", 1000); bListHelper.copyFileToRemoteHost(TestHealthScriptError.healthScriptError, client.getHostName(), remotePath, cluster); cluster.restartDaemonWithNewConfig(client, "mapred-site.xml", tConf, Role.TT); //make sure the TT is blacklisted bListHelper.verifyTTBlackList(tConf, client, "ERROR Task Tracker status is fatal", cluster); }
/** * Error in the test path and script will not run, the TT will not be marked * unhealthy * @throws Exception in case of test errors */ @Test public void testHealthScriptPathError() throws Exception { LOG.info("running testHealthScriptPathError"); TTClient client = cluster.getTTClient(); Configuration tConf= client.getProxy().getDaemonConf(); tConf.set("mapred.task.tracker.report.address", cluster.getConf().get("mapred.task.tracker.report.address")); String defaultHealthScript = tConf.get("mapred.healthChecker.script.path"); Assert.assertTrue("Health script was not set", defaultHealthScript != null); tConf.set("mapred.healthChecker.script.path", remotePath+File.separator+ invalidHealthScript); tConf.setInt("mapred.healthChecker.interval",1000); cluster.restartDaemonWithNewConfig(client, "mapred-site.xml", tConf, Role.TT); //For a invalid health script the TT remains healthy helper.verifyTTNotBlackListed( client, tConf, cluster); cluster.restart(client, Role.TT); tConf = client.getProxy().getDaemonConf(); }
/** * In this case the test times out the task tracker will get blacklisted . * @throws Exception in case of test errors */ @Test public void testScriptTimeout() throws Exception { LOG.info("running testScriptTimeout"); TTClient client = cluster.getTTClient(); Configuration tConf= client.getProxy().getDaemonConf(); int defaultTimeout = tConf.getInt("mapred.healthChecker.script.timeout", 0); tConf.set("mapred.task.tracker.report.address", cluster.getConf().get("mapred.task.tracker.report.address")); Assert.assertTrue("Health script timeout was not set",defaultTimeout != 0); tConf.set("mapred.healthChecker.script.path", remotePath+File.separator+ healthScriptTimeout); tConf.setInt("mapred.healthChecker.script.timeout", 100); tConf.setInt("mapred.healthChecker.interval",1000); helper.copyFileToRemoteHost(healthScriptTimeout, client.getHostName(), remotePath, cluster); cluster.restartDaemonWithNewConfig(client, "mapred-site.xml", tConf, Role.TT); //make sure the TT is blacklisted helper.verifyTTBlackList(tConf, client, "Node health script timed out", cluster); //Now put back the task tracker in a health state cluster.restart(client, Role.TT); tConf = client.getProxy().getDaemonConf(); //now do the opposite of blacklist verification helper.deleteFileOnRemoteHost(remotePath+File.separator+healthScriptTimeout, client.getHostName()); }
/** * The test will induce the ERROR with health script, asserts the task tracker * is unhealthy and then revert backs to non error condition and verifies * the task tracker is healthy. When the task tracker is marked unhealthy * also verifies that is marked as blacklisted, and reverse is true when it is * healthy. Also this verifies the custom error message that is set when * the task tracker is marked unhealthy. * @throws Exception in case of test errors */ @Test public void testInduceError() throws Exception { LOG.info("running testInduceError"); TTClient client = cluster.getTTClient(); Configuration tConf= client.getProxy().getDaemonConf(); tConf.set("mapred.task.tracker.report.address", cluster.getConf().get("mapred.task.tracker.report.address")); String defaultHealthScript = tConf.get("mapred.healthChecker.script.path"); Assert.assertTrue("Health script was not set", defaultHealthScript != null); tConf.set("mapred.healthChecker.script.path", remotePath+File.separator+ healthScriptError); tConf.setInt("mapred.healthChecker.interval", 1000); helper.copyFileToRemoteHost(healthScriptError, client.getHostName(), remotePath, cluster); cluster.restartDaemonWithNewConfig(client, "mapred-site.xml", tConf, Role.TT); //make sure the TT is blacklisted helper.verifyTTBlackList(tConf, client, "ERROR Task Tracker status is fatal", cluster); //Now put back the task tracker in a healthy state cluster.restart(client, Role.TT); //now do the opposite of blacklist verification tConf = client.getProxy().getDaemonConf(); helper.deleteFileOnRemoteHost(remotePath+File.separator+healthScriptError, client.getHostName()); }
private void unBlackListTT (TTClient client) throws Exception{ //Now put back the task tracker in a healthy state cluster.restart(client, Role.TT); bListHelper.deleteFileOnRemoteHost(remotePath + File.separator + TestHealthScriptError.healthScriptError, client.getHostName()); }