YARN-5114. Add additional tests in TestRMWebServicesApps and rectify testInvalidAppAttempts failure in 2.8. Contributed by Bibin A Chundatt

This commit is contained in:
Naganarasimha 2016-05-25 06:27:44 +08:00
parent 2ab789b19e
commit 943cefc81e
1 changed files with 4 additions and 5 deletions

View File

@ -1499,7 +1499,7 @@ public void testAppAttemtpsDefault() throws JSONException, Exception {
} }
@Test @Test
public void testInvalidAppAttempts() throws JSONException, Exception { public void testInvalidAppIdGetAttempts() throws JSONException, Exception {
rm.start(); rm.start();
MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048); MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
RMApp app = rm.submitApp(CONTAINER_MB); RMApp app = rm.submitApp(CONTAINER_MB);
@ -1508,8 +1508,7 @@ public void testInvalidAppAttempts() throws JSONException, Exception {
try { try {
r.path("ws").path("v1").path("cluster").path("apps") r.path("ws").path("v1").path("cluster").path("apps")
.path(app.getApplicationId().toString()).path("appattempts") .path("application_invalid_12").path("appattempts")
.path("appattempt_invalid_12_000001")
.accept(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)
.get(JSONObject.class); .get(JSONObject.class);
fail("should have thrown exception on invalid appAttempt"); fail("should have thrown exception on invalid appAttempt");
@ -1525,8 +1524,8 @@ public void testInvalidAppAttempts() throws JSONException, Exception {
String type = exception.getString("exception"); String type = exception.getString("exception");
String classname = exception.getString("javaClassName"); String classname = exception.getString("javaClassName");
WebServicesTestUtils.checkStringMatch("exception message", WebServicesTestUtils.checkStringMatch("exception message",
"java.lang.IllegalArgumentException: Invalid AppAttemptId:" "java.lang.IllegalArgumentException: Invalid ApplicationId:"
+ " appattempt_invalid_12_000001", + " application_invalid_12",
message); message);
WebServicesTestUtils.checkStringMatch("exception type", WebServicesTestUtils.checkStringMatch("exception type",
"BadRequestException", type); "BadRequestException", type);