ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject incubator-ranger git commit: Delete the kafka log dir after the test run
Date Thu, 22 Dec 2016 12:31:58 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/master e19936732 -> 937613250


Delete the kafka log dir after the test run


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/93761325
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/93761325
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/93761325

Branch: refs/heads/master
Commit: 937613250e4d4793c3ab89ec82d1b28a0b57451b
Parents: e199367
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Dec 22 12:31:38 2016 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Dec 22 12:31:38 2016 +0000

----------------------------------------------------------------------
 .../kafka/authorizer/KafkaRangerAuthorizerTest.java      | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/93761325/plugin-kafka/src/test/java/org/apache/ranger/authorization/kafka/authorizer/KafkaRangerAuthorizerTest.java
----------------------------------------------------------------------
diff --git a/plugin-kafka/src/test/java/org/apache/ranger/authorization/kafka/authorizer/KafkaRangerAuthorizerTest.java
b/plugin-kafka/src/test/java/org/apache/ranger/authorization/kafka/authorizer/KafkaRangerAuthorizerTest.java
index 1039b57..4a4e2b5 100644
--- a/plugin-kafka/src/test/java/org/apache/ranger/authorization/kafka/authorizer/KafkaRangerAuthorizerTest.java
+++ b/plugin-kafka/src/test/java/org/apache/ranger/authorization/kafka/authorizer/KafkaRangerAuthorizerTest.java
@@ -21,6 +21,8 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.math.BigInteger;
 import java.net.ServerSocket;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
 import java.security.KeyStore;
@@ -34,6 +36,7 @@ import java.util.concurrent.Future;
 
 import org.I0Itec.zkclient.ZkClient;
 import org.I0Itec.zkclient.ZkConnection;
+import org.apache.commons.io.FileUtils;
 import org.apache.curator.test.TestingServer;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.kafka.clients.CommonClientConfigs;
@@ -81,6 +84,7 @@ public class KafkaRangerAuthorizerTest {
     private static String serviceKeystorePath;
     private static String clientKeystorePath;
     private static String truststorePath;
+    private static Path tempDir;
     
     @org.junit.BeforeClass
     public static void setup() throws Exception {
@@ -105,12 +109,14 @@ public class KafkaRangerAuthorizerTest {
         ServerSocket serverSocket = new ServerSocket(0);
         port = serverSocket.getLocalPort();
         serverSocket.close();
+
+        tempDir = Files.createTempDirectory("kafka");
         
         final Properties props = new Properties();
         props.put("broker.id", 1);
         props.put("host.name", "localhost");
         props.put("port", port);
-        props.put("log.dir", "/tmp/kafka");
+        props.put("log.dir", tempDir.toString());
         props.put("zookeeper.connect", zkServer.getConnectString());
         props.put("replica.socket.timeout.ms", "1500");
         props.put("controlled.shutdown.enable", Boolean.TRUE.toString());
@@ -164,6 +170,9 @@ public class KafkaRangerAuthorizerTest {
         if (truststoreFile.exists()) {
             truststoreFile.delete();
         }
+        if (tempDir != null) {
+            FileUtils.deleteDirectory(tempDir.toFile());
+        }
     }
     
     private static String createAndStoreKey(String subjectName, String issuerName, BigInteger
serial, String keystorePassword,


Mime
View raw message