You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by co...@apache.org on 2017/06/26 08:37:21 UTC
ranger git commit: RANGER-1663 - Make Kafka GSS test more robust
Repository: ranger
Updated Branches:
refs/heads/master a75eed841 -> e52e2b271
RANGER-1663 - Make Kafka GSS test more robust
Signed-off-by: Colm O hEigeartaigh <co...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/e52e2b27
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/e52e2b27
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/e52e2b27
Branch: refs/heads/master
Commit: e52e2b271399c4d40b23da2a099b0dc16ed840c0
Parents: a75eed8
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Jun 23 10:01:51 2017 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon Jun 26 09:26:11 2017 +0100
----------------------------------------------------------------------
.../kafka/authorizer/KafkaRangerAuthorizerGSSTest.java | 9 +++++++--
plugin-kafka/src/test/resources/kafka_kerberos.jaas | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ranger/blob/e52e2b27/plugin-kafka/src/test/java/org/apache/ranger/authorization/kafka/authorizer/KafkaRangerAuthorizerGSSTest.java
----------------------------------------------------------------------
diff --git a/plugin-kafka/src/test/java/org/apache/ranger/authorization/kafka/authorizer/KafkaRangerAuthorizerGSSTest.java b/plugin-kafka/src/test/java/org/apache/ranger/authorization/kafka/authorizer/KafkaRangerAuthorizerGSSTest.java
index 2b65cbf..d072a6f 100644
--- a/plugin-kafka/src/test/java/org/apache/ranger/authorization/kafka/authorizer/KafkaRangerAuthorizerGSSTest.java
+++ b/plugin-kafka/src/test/java/org/apache/ranger/authorization/kafka/authorizer/KafkaRangerAuthorizerGSSTest.java
@@ -18,6 +18,7 @@
package org.apache.ranger.authorization.kafka.authorizer;
import java.io.File;
+import java.net.InetAddress;
import java.net.ServerSocket;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystems;
@@ -84,13 +85,16 @@ public class KafkaRangerAuthorizerGSSTest {
configureKerby(basedir);
+ String address = InetAddress.getLocalHost().getHostAddress();
+
// JAAS Config file - We need to point to the correct keytab files
Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/kafka_kerberos.jaas");
String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
content = content.replaceAll("<basedir>", basedir);
+ content = content.replaceAll("zookeeper/localhost", "zookeeper/" + address);
Path path2 = FileSystems.getDefault().getPath(basedir, "/target/test-classes/kafka_kerberos.jaas");
- Files.write(path2, content.getBytes());
+ Files.write(path2, content.getBytes(StandardCharsets.UTF_8));
System.setProperty("java.security.auth.login.config", path2.toString());
@@ -159,7 +163,8 @@ public class KafkaRangerAuthorizerGSSTest {
kerbyServer.init();
// Create principals
- String zookeeper = "zookeeper/127.0.0.1@kafka.apache.org";
+ String address = InetAddress.getLocalHost().getHostAddress();
+ String zookeeper = "zookeeper/" + address + "@kafka.apache.org";
String kafka = "kafka/localhost@kafka.apache.org";
String client = "client@kafka.apache.org";
http://git-wip-us.apache.org/repos/asf/ranger/blob/e52e2b27/plugin-kafka/src/test/resources/kafka_kerberos.jaas
----------------------------------------------------------------------
diff --git a/plugin-kafka/src/test/resources/kafka_kerberos.jaas b/plugin-kafka/src/test/resources/kafka_kerberos.jaas
index b764932..1de804b 100644
--- a/plugin-kafka/src/test/resources/kafka_kerberos.jaas
+++ b/plugin-kafka/src/test/resources/kafka_kerberos.jaas
@@ -1,7 +1,7 @@
Server {
com.sun.security.auth.module.Krb5LoginModule required refreshKrb5Config=true useKeyTab=true
- keyTab="<basedir>/target/zookeeper.keytab" storeKey=true principal="zookeeper/127.0.0.1";
+ keyTab="<basedir>/target/zookeeper.keytab" storeKey=true principal="zookeeper/localhost";
};
KafkaServer {