knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmin...@apache.org
Subject knox git commit: KNOX-620: Jenkins Knox-master-verify failing since #725 due to JDK version issues. Logging cleanup.
Date Mon, 09 Nov 2015 22:41:18 GMT
Repository: knox
Updated Branches:
  refs/heads/master 56cedc0ae -> 9632b6970


KNOX-620: Jenkins Knox-master-verify failing since #725 due to JDK version issues. Logging
cleanup.


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/9632b697
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/9632b697
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/9632b697

Branch: refs/heads/master
Commit: 9632b697060bfeffa2e03425451a3e9b3980c45e
Parents: 56cedc0
Author: Kevin Minder <kevin.minder@hortonworks.com>
Authored: Mon Nov 9 17:41:10 2015 -0500
Committer: Kevin Minder <kevin.minder@hortonworks.com>
Committed: Mon Nov 9 17:41:10 2015 -0500

----------------------------------------------------------------------
 .../gateway/GatewayAdminTopologyFuncTest.java   | 19 +++++++++-----
 .../hadoop/gateway/GatewayBasicFuncTest.java    | 27 ++++++++++----------
 .../hadoop/gateway/GatewaySampleFuncTest.java   |  4 +--
 .../gateway/KnoxCliLdapFuncTestNegative.java    | 13 ++++++++--
 .../gateway/KnoxCliLdapFuncTestPositive.java    | 11 ++++++--
 .../hadoop/gateway/KnoxCliSysBindTest.java      |  8 +++++-
 .../src/test/resources/log4j.properties         |  2 +-
 7 files changed, 57 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/9632b697/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminTopologyFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminTopologyFuncTest.java
b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminTopologyFuncTest.java
index ef18740..6a7db25 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminTopologyFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminTopologyFuncTest.java
@@ -58,6 +58,7 @@ import java.util.UUID;
 
 import static com.jayway.restassured.RestAssured.given;
 import static org.apache.hadoop.test.TestUtils.LOG_ENTER;
+import static org.apache.hadoop.test.TestUtils.LOG_EXIT;
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.not;
@@ -312,9 +313,6 @@ public class GatewayAdminTopologyFuncTest {
         .when().get(serviceUrl);
 
 
-
-
-
     given()
         //.log().all()
         .auth().preemptive().basic(username, password)
@@ -333,6 +331,7 @@ public class GatewayAdminTopologyFuncTest {
         .body("topology.name", equalTo("test-cluster"))
         .when().get(href1);
 
+    LOG_EXIT();
   }
 
   @Test( timeout = LONG_TIMEOUT )
@@ -394,6 +393,7 @@ public class GatewayAdminTopologyFuncTest {
         .when()
         .get(hrefXml);
 
+    LOG_EXIT();
   }
 
   @Test( timeout = LONG_TIMEOUT )
@@ -421,6 +421,7 @@ public class GatewayAdminTopologyFuncTest {
         .body("topologies.topology[1].timestamp", not(nullValue()))
         .get(url);
 
+    LOG_EXIT();
   }
 
   @Test( timeout = LONG_TIMEOUT )
@@ -439,8 +440,7 @@ public class GatewayAdminTopologyFuncTest {
         .statusCode(HttpStatus.SC_FORBIDDEN)
         .get(url);
 
-
-
+    LOG_EXIT();
   }
 
   private Topology createTestTopology(){
@@ -555,6 +555,8 @@ public class GatewayAdminTopologyFuncTest {
         .statusCode(HttpStatus.SC_NOT_FOUND)
         .when()
         .get(url);
+
+    LOG_EXIT();
   }
 
   @Test( timeout = LONG_TIMEOUT )
@@ -596,6 +598,8 @@ public class GatewayAdminTopologyFuncTest {
         //.log().all()
         .statusCode(HttpStatus.SC_NO_CONTENT)
         .get(url);
+
+    LOG_EXIT();
   }
 
   @Test( timeout = LONG_TIMEOUT )
@@ -662,6 +666,7 @@ public class GatewayAdminTopologyFuncTest {
         .get(url)
         .getBody().asString();
 
+    LOG_EXIT();
   }
 
   @Test( timeout = LONG_TIMEOUT )
@@ -695,7 +700,7 @@ public class GatewayAdminTopologyFuncTest {
         .body(containsString(newUrl))
         .body(containsString("test-cluster"))
         .body(containsString("admin"))
-        .get(url).prettyPrint();
+        .get(url);
 
 
 //     Case 2: add in x-forward headers (host, server, proto, context)
@@ -777,6 +782,7 @@ public class GatewayAdminTopologyFuncTest {
         .body(containsString("admin"))
         .get(url);
 
+    LOG_EXIT();
   }
 
   @Test( timeout = LONG_TIMEOUT )
@@ -822,6 +828,7 @@ public class GatewayAdminTopologyFuncTest {
       setupGateway(new GatewayTestConfig());
     }
 
+    LOG_EXIT();
   }
 
   private static final String CLASS = GatewayAdminTopologyFuncTest.class.getCanonicalName();

http://git-wip-us.apache.org/repos/asf/knox/blob/9632b697/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java
b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java
index c56081d..8a96ee3 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java
@@ -29,7 +29,6 @@ import org.apache.hadoop.gateway.util.KnoxCLI;
 import org.apache.hadoop.test.TestUtils;
 import org.apache.hadoop.test.category.FunctionalTests;
 import org.apache.hadoop.test.category.MediumTests;
-import org.apache.hadoop.test.log.NoOpLogger;
 import org.apache.hadoop.test.mock.MockRequestMatcher;
 import org.apache.http.HttpStatus;
 import org.apache.velocity.Template;
@@ -37,7 +36,6 @@ import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.runtime.RuntimeConstants;
 import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
-import org.eclipse.jetty.util.log.Log;
 import org.hamcrest.Matcher;
 import org.hamcrest.MatcherAssert;
 import org.hamcrest.Matchers;
@@ -45,20 +43,19 @@ import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.core.MediaType;
-import java.io.PrintStream;
-import java.io.IOException;
-import java.io.StringWriter;
+import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.FileFilter;
-import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.StringWriter;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
@@ -71,7 +68,11 @@ import java.util.Map.Entry;
 import static com.jayway.restassured.RestAssured.given;
 import static org.apache.hadoop.test.TestUtils.LOG_ENTER;
 import static org.apache.hadoop.test.TestUtils.LOG_EXIT;
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.anyOf;
+import static org.hamcrest.CoreMatchers.either;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.startsWith;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.greaterThan;
@@ -375,13 +376,13 @@ public class GatewayBasicFuncTest {
         .respond()
         .status( HttpStatus.SC_OK );
     given()
-        .log().all()
+        //.log().all()
         .auth().preemptive().basic( username, password )
         .header("X-XSRF-Header", "jksdhfkhdsf")
         .queryParam( "op", "DELETE" )
         .queryParam( "recursive", "true" )
         .expect()
-        .log().all()
+        //.log().all()
         .statusCode( HttpStatus.SC_OK )
         .when().delete( driver.getUrl( "WEBHDFS" ) + "/v1/~" + root + ( driver.isUseGateway()
? "" : "?user.name=" + username ) );
     driver.assertComplete();
@@ -402,7 +403,7 @@ public class GatewayBasicFuncTest {
         .header("X-XSRF-Header", "jksdhfkhdsf")
         .queryParam( "op", "MKDIRS" )
         .expect()
-            //.log().all();
+        //.log().all();
         .statusCode( HttpStatus.SC_OK )
         .contentType( "application/json" )
         .content( "boolean", is( true ) )
@@ -441,7 +442,7 @@ public class GatewayBasicFuncTest {
         .queryParam( "op", "DELETE" )
         .queryParam( "recursive", "true" )
         .expect()
-        .log().all()
+        //.log().all()
         .statusCode( HttpStatus.SC_OK )
         .when().delete( driver.getUrl( "WEBHDFS" ) + "/v1" + root + ( driver.isUseGateway()
? "" : "?user.name=" + username ) );
     driver.assertComplete();

http://git-wip-us.apache.org/repos/asf/knox/blob/9632b697/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewaySampleFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewaySampleFuncTest.java
b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewaySampleFuncTest.java
index 7f6f9c1..2d63b5d 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewaySampleFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewaySampleFuncTest.java
@@ -215,10 +215,10 @@ public class GatewaySampleFuncTest {
     String password = "guest-password";
     String serviceUrl =  clusterUrl + "/test-service-path/test-service-resource";
     given()
-        .log().all()
+        //.log().all()
         .auth().preemptive().basic( username, password )
         .expect()
-        .log().all()
+        //.log().all()
         .statusCode( HttpStatus.SC_OK )
         .contentType( "text/plain" )
         .body( is( "test-service-response" ) )

http://git-wip-us.apache.org/repos/asf/knox/blob/9632b697/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliLdapFuncTestNegative.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliLdapFuncTestNegative.java
b/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliLdapFuncTestNegative.java
index a79e613..85e5f8f 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliLdapFuncTestNegative.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliLdapFuncTestNegative.java
@@ -19,11 +19,14 @@ package org.apache.hadoop.gateway;
 
 import com.mycila.xmltool.XMLDoc;
 import com.mycila.xmltool.XMLTag;
+import org.apache.commons.logging.impl.NoOpLog;
 import org.apache.directory.server.protocol.shared.transport.TcpTransport;
 import org.apache.hadoop.gateway.security.ldap.SimpleLdapDirectoryServer;
 import org.apache.hadoop.gateway.services.DefaultGatewayServices;
 import org.apache.hadoop.gateway.services.ServiceLifecycleException;
 import org.apache.hadoop.gateway.util.KnoxCLI;;
+import org.apache.hadoop.test.log.NoOpAppender;
+import org.apache.hadoop.test.log.NoOpLogger;
 import org.apache.log4j.Appender;
 import org.hamcrest.Matchers;
 import org.junit.BeforeClass;
@@ -54,6 +57,7 @@ import static org.junit.Assert.assertThat;
 public class KnoxCliLdapFuncTestNegative {
 
   private static final long SHORT_TIMEOUT = 1000L;
+  private static final long MEDIUM_TIMEOUT = 5 * SHORT_TIMEOUT;
 
   private static Class RESOURCE_BASE_CLASS = KnoxCliLdapFuncTestPositive.class;
   private static Logger LOG = LoggerFactory.getLogger( KnoxCliLdapFuncTestPositive.class
);
@@ -280,7 +284,7 @@ public class KnoxCliLdapFuncTestNegative {
     return xml;
   }
 
-  @Test( timeout = SHORT_TIMEOUT )
+  @Test( timeout = MEDIUM_TIMEOUT )
   public void testBadTopology() throws Exception {
     LOG_ENTER();
 
@@ -309,7 +313,12 @@ public class KnoxCliLdapFuncTestNegative {
 
     String args2[] = {"user-auth-test", "--master", "knox", "--cluster", "bad-cluster",
         "--u", username, "--p", password, "--g" };
-    cli.run( args2 );
+    Enumeration<Appender> before = NoOpAppender.setUp();
+    try {
+      cli.run( args2 );
+    } finally {
+      NoOpAppender.tearDown( before );
+    }
 
     assertThat(outContent.toString(), containsString("LDAP authentication failed"));
     assertThat(outContent.toString(), containsString("INVALID_CREDENTIALS"));

http://git-wip-us.apache.org/repos/asf/knox/blob/9632b697/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliLdapFuncTestPositive.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliLdapFuncTestPositive.java
b/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliLdapFuncTestPositive.java
index fb08531..d6f6d45 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliLdapFuncTestPositive.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliLdapFuncTestPositive.java
@@ -24,6 +24,7 @@ import org.apache.hadoop.gateway.security.ldap.SimpleLdapDirectoryServer;
 import org.apache.hadoop.gateway.services.DefaultGatewayServices;
 import org.apache.hadoop.gateway.services.ServiceLifecycleException;
 import org.apache.hadoop.gateway.util.KnoxCLI;;
+import org.apache.hadoop.test.log.NoOpAppender;
 import org.apache.log4j.Appender;
 import org.hamcrest.Matchers;
 import org.junit.BeforeClass;
@@ -54,6 +55,7 @@ import static org.junit.Assert.assertThat;
 public class KnoxCliLdapFuncTestPositive {
 
   private static final long SHORT_TIMEOUT = 1000L;
+  private static final long MEDIUM_TIMEOUT = 5 * SHORT_TIMEOUT;
 
   private static Class RESOURCE_BASE_CLASS = KnoxCliLdapFuncTestPositive.class;
   private static Logger LOG = LoggerFactory.getLogger( KnoxCliLdapFuncTestPositive.class
);
@@ -270,7 +272,7 @@ public class KnoxCliLdapFuncTestPositive {
     return xml;
   }
 
-  @Test( timeout = SHORT_TIMEOUT )
+  @Test( timeout = MEDIUM_TIMEOUT )
   public void testLDAPAuth() throws Exception {
     LOG_ENTER();
 
@@ -294,7 +296,12 @@ public class KnoxCliLdapFuncTestPositive {
     username = "bad-name";
     password = "bad-password";
     String args2[] = {"user-auth-test", "--master", "knox", "--cluster", "test-cluster",
"--u", username, "--p", password};
-    cli.run(args2);
+    Enumeration<Appender> before = NoOpAppender.setUp();
+    try {
+      cli.run( args2 );
+    } finally {
+      NoOpAppender.tearDown( before );
+    }
     assertThat(outContent.toString(), containsString("LDAP authentication failed"));
 
 //    Test 3: Authenticate a user who belongs to no groups, but specify groups with --g

http://git-wip-us.apache.org/repos/asf/knox/blob/9632b697/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliSysBindTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliSysBindTest.java
b/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliSysBindTest.java
index 3676fdc..3bb2ef3 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliSysBindTest.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/KnoxCliSysBindTest.java
@@ -24,6 +24,7 @@ import org.apache.hadoop.gateway.security.ldap.SimpleLdapDirectoryServer;
 import org.apache.hadoop.gateway.services.DefaultGatewayServices;
 import org.apache.hadoop.gateway.services.ServiceLifecycleException;
 import org.apache.hadoop.gateway.util.KnoxCLI;
+import org.apache.hadoop.test.log.NoOpAppender;
 import org.apache.log4j.Appender;
 import org.hamcrest.Matchers;
 import org.junit.AfterClass;
@@ -302,7 +303,12 @@ public class KnoxCliSysBindTest {
     String args3[] = { "system-user-auth-test", "--master", "knox", "--cluster", "test-cluster-3",
"--d" };
     cli = new KnoxCLI();
     cli.setConf(config);
-    cli.run(args3);
+    Enumeration<Appender> before = NoOpAppender.setUp();
+    try {
+      cli.run( args3 );
+    } finally {
+      NoOpAppender.tearDown( before );
+    }
     assertThat(outContent.toString(), containsString("LDAP authentication failed"));
     assertThat(outContent.toString(), containsString("Unable to successfully bind to LDAP
server with topology credentials"));
 

http://git-wip-us.apache.org/repos/asf/knox/blob/9632b697/gateway-test/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/resources/log4j.properties b/gateway-test/src/test/resources/log4j.properties
index cc3eed1..2e28e37 100644
--- a/gateway-test/src/test/resources/log4j.properties
+++ b/gateway-test/src/test/resources/log4j.properties
@@ -23,7 +23,7 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n
 
-log4j.logger.org.apache.hadoop.gateway=DEBUG
+log4j.logger.org.apache.hadoop.gateway=ERROR
 #log4j.logger.org.apache.hadoop.gateway.http=TRACE
 #log4j.logger.org.apache.hadoop.gateway.http.request.body=OFF
 #log4j.logger.org.apache.hadoop.gateway.http.response.body=OFF


Mime
View raw message