YARN-1863. Fixed test failure in TestRMFailover after YARN-1859. Contributed by Xuan Gong.
svn merge --ignore-ancestry -c 1580094 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1580095 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
08a194fb55
commit
b51df9d67d
|
@ -531,6 +531,9 @@ Release 2.4.0 - UNRELEASED
|
||||||
YARN-1849. Fixed NPE in ResourceTrackerService#registerNodeManager for UAM
|
YARN-1849. Fixed NPE in ResourceTrackerService#registerNodeManager for UAM
|
||||||
(Karthik Kambatla via jianhe )
|
(Karthik Kambatla via jianhe )
|
||||||
|
|
||||||
|
YARN-1863. Fixed test failure in TestRMFailover after YARN-1859. (Xuan Gong
|
||||||
|
via vinodkv)
|
||||||
|
|
||||||
Release 2.3.1 - UNRELEASED
|
Release 2.3.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -39,7 +39,6 @@ import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.client.api.YarnClient;
|
import org.apache.hadoop.yarn.client.api.YarnClient;
|
||||||
import org.apache.hadoop.yarn.conf.HAUtil;
|
import org.apache.hadoop.yarn.conf.HAUtil;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException;
|
|
||||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||||
import org.apache.hadoop.yarn.server.MiniYARNCluster;
|
import org.apache.hadoop.yarn.server.MiniYARNCluster;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.AdminService;
|
import org.apache.hadoop.yarn.server.resourcemanager.AdminService;
|
||||||
|
@ -208,17 +207,19 @@ public class TestRMFailover extends ClientBaseWithFixes {
|
||||||
webAppProxyServer.start();
|
webAppProxyServer.start();
|
||||||
Assert.assertEquals(STATE.STARTED, webAppProxyServer.getServiceState());
|
Assert.assertEquals(STATE.STARTED, webAppProxyServer.getServiceState());
|
||||||
|
|
||||||
|
// send httpRequest with fakeApplicationId
|
||||||
|
// expect to get "Not Found" response and 404 response code
|
||||||
URL wrongUrl = new URL("http://0.0.0.0:9099/proxy/" + fakeAppId);
|
URL wrongUrl = new URL("http://0.0.0.0:9099/proxy/" + fakeAppId);
|
||||||
HttpURLConnection proxyConn = (HttpURLConnection) wrongUrl
|
HttpURLConnection proxyConn = (HttpURLConnection) wrongUrl
|
||||||
.openConnection();
|
.openConnection();
|
||||||
|
|
||||||
proxyConn.connect();
|
proxyConn.connect();
|
||||||
verifyExpectedException(proxyConn.getResponseMessage());
|
verifyResponse(proxyConn);
|
||||||
|
|
||||||
explicitFailover();
|
explicitFailover();
|
||||||
verifyConnections();
|
verifyConnections();
|
||||||
proxyConn.connect();
|
proxyConn.connect();
|
||||||
verifyExpectedException(proxyConn.getResponseMessage());
|
verifyResponse(proxyConn);
|
||||||
} finally {
|
} finally {
|
||||||
webAppProxyServer.stop();
|
webAppProxyServer.stop();
|
||||||
}
|
}
|
||||||
|
@ -233,25 +234,26 @@ public class TestRMFailover extends ClientBaseWithFixes {
|
||||||
getAdminService(0).transitionToActive(req);
|
getAdminService(0).transitionToActive(req);
|
||||||
assertFalse("RM never turned active", -1 == cluster.getActiveRMIndex());
|
assertFalse("RM never turned active", -1 == cluster.getActiveRMIndex());
|
||||||
verifyConnections();
|
verifyConnections();
|
||||||
|
|
||||||
|
// send httpRequest with fakeApplicationId
|
||||||
|
// expect to get "Not Found" response and 404 response code
|
||||||
URL wrongUrl = new URL("http://0.0.0.0:18088/proxy/" + fakeAppId);
|
URL wrongUrl = new URL("http://0.0.0.0:18088/proxy/" + fakeAppId);
|
||||||
HttpURLConnection proxyConn = (HttpURLConnection) wrongUrl
|
HttpURLConnection proxyConn = (HttpURLConnection) wrongUrl
|
||||||
.openConnection();
|
.openConnection();
|
||||||
|
|
||||||
proxyConn.connect();
|
proxyConn.connect();
|
||||||
verifyExpectedException(proxyConn.getResponseMessage());
|
verifyResponse(proxyConn);
|
||||||
|
|
||||||
explicitFailover();
|
explicitFailover();
|
||||||
verifyConnections();
|
verifyConnections();
|
||||||
proxyConn.connect();
|
proxyConn.connect();
|
||||||
verifyExpectedException(proxyConn.getResponseMessage());
|
verifyResponse(proxyConn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyExpectedException(String exceptionMessage){
|
private void verifyResponse(HttpURLConnection response)
|
||||||
assertTrue(exceptionMessage.contains(ApplicationNotFoundException.class
|
throws IOException {
|
||||||
.getName()));
|
assertEquals("Not Found", response.getResponseMessage());
|
||||||
assertTrue(exceptionMessage
|
assertEquals(404, response.getResponseCode());
|
||||||
.contains("Application with id '" + fakeAppId + "' " +
|
|
||||||
"doesn't exist in RM."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue