Skip to content

Commit 53f93ad

Browse files
slfan1989HarshitGupta11
authored andcommitted
YARN-11192. TestRouterWebServicesREST failing after YARN-9827. (apache#4484). Contributed by fanshilun.
Signed-off-by: Ayush Saxena <[email protected]>
1 parent 8b92fbf commit 53f93ad

File tree

1 file changed

+22
-20
lines changed
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp

1 file changed

+22
-20
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestRouterWebServicesREST.java

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import static javax.servlet.http.HttpServletResponse.SC_ACCEPTED;
2222
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
23-
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
23+
import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
2424
import static javax.servlet.http.HttpServletResponse.SC_OK;
2525
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
2626
import static javax.ws.rs.core.MediaType.APPLICATION_XML;
@@ -143,6 +143,8 @@
143143

144144
import net.jcip.annotations.NotThreadSafe;
145145

146+
import javax.servlet.http.HttpServletRequest;
147+
146148
/**
147149
* This test validate E2E the correctness of the RouterWebServices. It starts
148150
* Router, RM and NM in 3 different processes to avoid servlet conflicts. Each
@@ -423,7 +425,7 @@ public void testSchedulerInfoXML() throws Exception {
423425

424426
/**
425427
* This test validates the correctness of
426-
* {@link RMWebServiceProtocol#getNodes()} inside Router.
428+
* {@link RMWebServiceProtocol#getNodes(String)} inside Router.
427429
*/
428430
@Test(timeout = 2000)
429431
public void testNodesEmptyXML() throws Exception {
@@ -444,7 +446,7 @@ public void testNodesEmptyXML() throws Exception {
444446

445447
/**
446448
* This test validates the correctness of
447-
* {@link RMWebServiceProtocol#getNodes()} inside Router.
449+
* {@link RMWebServiceProtocol#getNodes(String)} inside Router.
448450
*/
449451
@Test(timeout = 2000)
450452
public void testNodesXML() throws Exception {
@@ -465,7 +467,7 @@ public void testNodesXML() throws Exception {
465467

466468
/**
467469
* This test validates the correctness of
468-
* {@link RMWebServiceProtocol#getNode()} inside Router.
470+
* {@link RMWebServiceProtocol#getNode(String)} inside Router.
469471
*/
470472
@Test(timeout = 2000)
471473
public void testNodeXML() throws Exception {
@@ -528,7 +530,7 @@ public void testUpdateNodeResource() throws Exception {
528530

529531
/**
530532
* This test validates the correctness of
531-
* {@link RMWebServiceProtocol#getActivities()} inside Router.
533+
* {@link RMWebServiceProtocol#getActivities(HttpServletRequest, String, String)} inside Router.
532534
*/
533535
@Test(timeout = 2000)
534536
public void testActiviesXML() throws Exception {
@@ -600,7 +602,7 @@ public void testDumpSchedulerLogsXML() throws Exception {
600602
performCall(RM_WEB_SERVICE_PATH + SCHEDULER_LOGS,
601603
null, null, null, PUT);
602604

603-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
605+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
604606

605607
// Test with the correct HTTP method
606608
ClientResponse response = performCall(
@@ -623,7 +625,7 @@ public void testNewApplicationXML() throws Exception {
623625
RM_WEB_SERVICE_PATH + APPS_NEW_APPLICATION, null,
624626
null, null, PUT);
625627

626-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
628+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
627629

628630
// Test with the correct HTTP method
629631
ClientResponse response = performCall(
@@ -646,7 +648,7 @@ public void testSubmitApplicationXML() throws Exception {
646648
ClientResponse badResponse = performCall(
647649
RM_WEB_SERVICE_PATH + APPS, null, null, null, PUT);
648650

649-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
651+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
650652

651653
// Test with the correct HTTP method
652654
ApplicationSubmissionContextInfo context =
@@ -771,7 +773,7 @@ public void testUpdateAppStateXML() throws Exception {
771773
ClientResponse badResponse = performCall(
772774
pathApp, null, null, null, POST);
773775

774-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
776+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
775777

776778
// Test with the correct HTTP method
777779
AppState appState = new AppState("KILLED");
@@ -820,7 +822,7 @@ public void testUpdateAppPriorityXML() throws Exception {
820822
RM_WEB_SERVICE_PATH + format(APPS_APPID_PRIORITY, appId),
821823
null, null, null, POST);
822824

823-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
825+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
824826

825827
// Test with the correct HTTP method
826828
AppPriority appPriority = new AppPriority(1);
@@ -870,7 +872,7 @@ public void testUpdateAppQueueXML() throws Exception {
870872
RM_WEB_SERVICE_PATH + format(APPS_APPID_QUEUE, appId),
871873
null, null, null, POST);
872874

873-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
875+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
874876

875877
// Test with the correct HTTP method
876878
AppQueue appQueue = new AppQueue("default");
@@ -945,7 +947,7 @@ public void testUpdateAppTimeoutsXML() throws Exception {
945947
RM_WEB_SERVICE_PATH + format(APPS_TIMEOUT, appId),
946948
null, null, null, POST);
947949

948-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
950+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
949951

950952
// Test with a bad request
951953
AppTimeoutInfo appTimeoutInfo = new AppTimeoutInfo();
@@ -971,7 +973,7 @@ public void testNewReservationXML() throws Exception {
971973
RM_WEB_SERVICE_PATH + RESERVATION_NEW,
972974
null, null, null, PUT);
973975

974-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
976+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
975977

976978
// Test with the correct HTTP method
977979
ClientResponse response = performCall(
@@ -995,7 +997,7 @@ public void testSubmitReservationXML() throws Exception {
995997
RM_WEB_SERVICE_PATH + RESERVATION_SUBMIT, null,
996998
null, null, PUT);
997999

998-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
1000+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
9991001

10001002
// Test with the correct HTTP method
10011003
ReservationSubmissionRequestInfo context =
@@ -1022,7 +1024,7 @@ public void testUpdateReservationXML() throws Exception {
10221024
ClientResponse badResponse = performCall(
10231025
RM_WEB_SERVICE_PATH + RESERVATION_UPDATE, null, null, null, PUT);
10241026

1025-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
1027+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
10261028

10271029
// Test with the correct HTTP method
10281030
String reservationId = getNewReservationId().getReservationId();
@@ -1048,7 +1050,7 @@ public void testDeleteReservationXML() throws Exception {
10481050
ClientResponse badResponse = performCall(
10491051
RM_WEB_SERVICE_PATH + RESERVATION_DELETE, null, null, null, PUT);
10501052

1051-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
1053+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
10521054

10531055
// Test with the correct HTTP method
10541056
String reservationId = getNewReservationId().getReservationId();
@@ -1185,7 +1187,7 @@ public void testAddToClusterNodeLabelsXML() throws Exception {
11851187
RM_WEB_SERVICE_PATH + ADD_NODE_LABELS,
11861188
null, null, null, PUT);
11871189

1188-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
1190+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
11891191

11901192
// Test with the correct HTTP method
11911193

@@ -1213,7 +1215,7 @@ public void testRemoveFromClusterNodeLabelsXML()
12131215
ClientResponse badResponse = performCall(
12141216
RM_WEB_SERVICE_PATH + REMOVE_NODE_LABELS, null, null, null, PUT);
12151217

1216-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
1218+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
12171219

12181220
// Test with the correct HTTP method
12191221
addNodeLabel();
@@ -1238,7 +1240,7 @@ public void testReplaceLabelsOnNodesXML() throws Exception {
12381240
ClientResponse badResponse = performCall(
12391241
RM_WEB_SERVICE_PATH + REPLACE_NODE_TO_LABELS, null, null, null, PUT);
12401242

1241-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
1243+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
12421244

12431245
// Test with the correct HTTP method
12441246
addNodeLabel();
@@ -1267,7 +1269,7 @@ public void testReplaceLabelsOnNodeXML() throws Exception {
12671269
ClientResponse badResponse = performCall(
12681270
pathNode, null, null, null, PUT);
12691271

1270-
assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
1272+
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());
12711273

12721274
// Test with the correct HTTP method
12731275
addNodeLabel();

0 commit comments

Comments
 (0)