You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by gw...@apache.org on 2015/11/20 00:59:04 UTC
kafka git commit: KAFKA-2824: MiniKDC based tests don't run in
VirtualBox
Repository: kafka
Updated Branches:
refs/heads/trunk c7c7f4cfa -> 4e22abaa8
KAFKA-2824: MiniKDC based tests don't run in VirtualBox
This is a hack which works. Is there a better way?
Build (v2) of the replication_test.py running here: http://jenkins.confluent.io/job/kafka_system_tests_branch_builder/185/
Author: Ben Stopford <be...@gmail.com>
Reviewers: Geoff Anderson, Gwen Shapira
Closes #520 from benstopford/fix-for-sasl-virtual-box
Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/4e22abaa
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/4e22abaa
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/4e22abaa
Branch: refs/heads/trunk
Commit: 4e22abaa85414ab4679f22fdc25f531bc701f4c6
Parents: c7c7f4c
Author: Ben Stopford <be...@gmail.com>
Authored: Thu Nov 19 15:58:42 2015 -0800
Committer: Gwen Shapira <cs...@gmail.com>
Committed: Thu Nov 19 15:58:42 2015 -0800
----------------------------------------------------------------------
tests/kafkatest/services/security/minikdc.py | 18 +++++++++++++++++-
.../security/templates/minikdc.properties | 2 +-
2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kafka/blob/4e22abaa/tests/kafkatest/services/security/minikdc.py
----------------------------------------------------------------------
diff --git a/tests/kafkatest/services/security/minikdc.py b/tests/kafkatest/services/security/minikdc.py
index e1b4b95..b8d9c6a 100644
--- a/tests/kafkatest/services/security/minikdc.py
+++ b/tests/kafkatest/services/security/minikdc.py
@@ -17,7 +17,10 @@ from ducktape.services.service import Service
from kafkatest.services.kafka.directory import kafka_dir
import os
-
+from tempfile import mkstemp
+from shutil import move
+from os import remove, close
+from io import open
class MiniKdc(Service):
@@ -39,6 +42,16 @@ class MiniKdc(Service):
super(MiniKdc, self).__init__(context, 1)
self.kafka_nodes = kafka_nodes
+ def replace_in_file(self, file_path, pattern, subst):
+ fh, abs_path = mkstemp()
+ with open(abs_path, 'w') as new_file:
+ with open(file_path) as old_file:
+ for line in old_file:
+ new_file.write(line.replace(pattern, subst))
+ close(fh)
+ remove(file_path)
+ move(abs_path, file_path)
+
def start_node(self, node):
@@ -60,9 +73,12 @@ class MiniKdc(Service):
with node.account.monitor_log(MiniKdc.LOG_FILE) as monitor:
node.account.ssh(cmd)
monitor.wait_until("MiniKdc Running", timeout_sec=60, backoff_sec=1, err_msg="MiniKdc didn't finish startup")
+
node.account.scp_from(MiniKdc.KEYTAB_FILE, MiniKdc.LOCAL_KEYTAB_FILE)
node.account.scp_from(MiniKdc.KRB5CONF_FILE, MiniKdc.LOCAL_KRB5CONF_FILE)
+ #KDC is set to bind openly (via 0.0.0.0). Change krb5.conf to hold the specific KDC address
+ self.replace_in_file(MiniKdc.LOCAL_KRB5CONF_FILE, '0.0.0.0', node.account.hostname)
def stop_node(self, node):
self.logger.info("Stopping %s on %s" % (type(self).__name__, node.account.hostname))
http://git-wip-us.apache.org/repos/asf/kafka/blob/4e22abaa/tests/kafkatest/services/security/templates/minikdc.properties
----------------------------------------------------------------------
diff --git a/tests/kafkatest/services/security/templates/minikdc.properties b/tests/kafkatest/services/security/templates/minikdc.properties
index fce8f83..0990a33 100644
--- a/tests/kafkatest/services/security/templates/minikdc.properties
+++ b/tests/kafkatest/services/security/templates/minikdc.properties
@@ -13,5 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-kdc.bind.address={{ node.account.hostname }}
+kdc.bind.address=0.0.0.0