hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjs...@apache.org
Subject svn commit: r1606286 - in /hadoop/common/branches/branch-2/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/
Date Sat, 28 Jun 2014 03:33:47 GMT
Author: zjshen
Date: Sat Jun 28 03:33:46 2014
New Revision: 1606286

URL: http://svn.apache.org/r1606286
Log:
YARN-2201. Made TestRMWebServicesAppsModification be independent of the changes on yarn-default.xml.
Contributed by Varun Vasudev.
svn merge --ignore-ancestry -c 1606285 ../../trunk/

Modified:
    hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesAppsModification.java

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1606286&r1=1606285&r2=1606286&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Sat Jun 28 03:33:46 2014
@@ -284,6 +284,9 @@ Release 2.5.0 - UNRELEASED
     YARN-2104. Scheduler queue filter failed to work because index of queue
     column changed. (Wangda Tan via jlowe)
 
+    YARN-2201. Made TestRMWebServicesAppsModification be independent of the
+    changes on yarn-default.xml. (Varun Vasudev via zjshen)
+
 Release 2.4.1 - 2014-06-23 
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesAppsModification.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesAppsModification.java?rev=1606286&r1=1606285&r2=1606286&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesAppsModification.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesAppsModification.java
Sat Jun 28 03:33:46 2014
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.server.re
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
 
 import java.io.IOException;
 import java.io.StringReader;
@@ -49,6 +50,7 @@ import org.apache.hadoop.yarn.server.res
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
 import org.apache.hadoop.yarn.server.resourcemanager.security.QueueACLsManager;
 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppState;
@@ -93,6 +95,8 @@ public class TestRMWebServicesAppsModifi
   private Injector injector;
   private String webserviceUserName = "testuser";
 
+  private boolean setAuthFilter = false;
+
   public class GuiceServletConfig extends GuiceServletContextListener {
 
     @Override
@@ -131,7 +135,6 @@ public class TestRMWebServicesAppsModifi
 
   private class TestServletModule extends ServletModule {
     public Configuration conf = new Configuration();
-    boolean setAuthFilter = false;
 
     @Override
     protected void configureServlets() {
@@ -157,6 +160,7 @@ public class TestRMWebServicesAppsModifi
     return Guice.createInjector(new TestServletModule() {
       @Override
       protected void configureServlets() {
+        setAuthFilter = false;
         super.configureServlets();
       }
     });
@@ -204,8 +208,8 @@ public class TestRMWebServicesAppsModifi
     }
   }
 
-  private boolean isAuthorizationEnabled() {
-    return rm.getConfig().getBoolean(YarnConfiguration.YARN_ACL_ENABLE, false);
+  private boolean isAuthenticationEnabled() {
+    return setAuthFilter;
   }
 
   private WebResource constructWebResource(WebResource r, String... paths) {
@@ -213,7 +217,7 @@ public class TestRMWebServicesAppsModifi
     for (String path : paths) {
       rt = rt.path(path);
     }
-    if (isAuthorizationEnabled()) {
+    if (isAuthenticationEnabled()) {
       rt = rt.queryParam("user.name", webserviceUserName);
     }
     return rt;
@@ -280,7 +284,7 @@ public class TestRMWebServicesAppsModifi
                 "state").entity(entity, contentType).accept(mediaType)
               .put(ClientResponse.class);
 
-        if (!isAuthorizationEnabled()) {
+        if (!isAuthenticationEnabled()) {
           assertEquals(Status.UNAUTHORIZED, response.getClientResponseStatus());
           continue;
         }
@@ -295,7 +299,7 @@ public class TestRMWebServicesAppsModifi
             response.getHeaders().getFirst(HttpHeaders.LOCATION);
         Client c = Client.create();
         WebResource tmp = c.resource(locationHeaderValue);
-        if (isAuthorizationEnabled()) {
+        if (isAuthenticationEnabled()) {
           tmp = tmp.queryParam("user.name", webserviceUserName);
         }
         response = tmp.get(ClientResponse.class);
@@ -361,7 +365,7 @@ public class TestRMWebServicesAppsModifi
                 .entity(entity, contentType).accept(mediaType)
                 .put(ClientResponse.class);
 
-          if (!isAuthorizationEnabled()) {
+          if (!isAuthenticationEnabled()) {
             assertEquals(Status.UNAUTHORIZED,
               response.getClientResponseStatus());
             continue;
@@ -426,6 +430,11 @@ public class TestRMWebServicesAppsModifi
   @Test(timeout = 30000)
   public void testSingleAppKillUnauthorized() throws Exception {
 
+    boolean isCapacityScheduler =
+        rm.getResourceScheduler() instanceof CapacityScheduler;
+    assumeTrue("Currently this test is only supported on CapacityScheduler",
+      isCapacityScheduler);
+
     // default root queue allows anyone to have admin acl
     CapacitySchedulerConfiguration csconf =
         new CapacitySchedulerConfiguration();
@@ -452,7 +461,7 @@ public class TestRMWebServicesAppsModifi
             .constructWebResource("apps", app.getApplicationId().toString(),
               "state").accept(mediaType)
             .entity(info, MediaType.APPLICATION_XML).put(ClientResponse.class);
-      if (!isAuthorizationEnabled()) {
+      if (!isAuthenticationEnabled()) {
         assertEquals(Status.UNAUTHORIZED, response.getClientResponseStatus());
       } else {
         assertEquals(Status.FORBIDDEN, response.getClientResponseStatus());
@@ -475,7 +484,7 @@ public class TestRMWebServicesAppsModifi
           this.constructWebResource("apps", testAppId, "state")
             .accept(MediaType.APPLICATION_XML)
             .entity(info, MediaType.APPLICATION_XML).put(ClientResponse.class);
-      if (!isAuthorizationEnabled()) {
+      if (!isAuthenticationEnabled()) {
         assertEquals(Status.UNAUTHORIZED, response.getClientResponseStatus());
         continue;
       }



Mime
View raw message