diff options
author | Dana Powers <dana.powers@gmail.com> | 2016-04-25 13:39:07 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2016-04-25 16:26:44 -0700 |
commit | c7564d239795f9d20f5a027f32130ee1ae84ab3e (patch) | |
tree | fa850398ee7cff8d65a5e86984a88af5fe12f4b4 | |
parent | aefafd270a75b9a3d21c148eefba5ba56cbc622b (diff) | |
download | kafka-python-c7564d239795f9d20f5a027f32130ee1ae84ab3e.tar.gz |
Allow setting host interface in KafkaFixture.instance
-rw-r--r-- | test/fixtures.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/fixtures.py b/test/fixtures.py index 654e636..b8d6fc3 100644 --- a/test/fixtures.py +++ b/test/fixtures.py @@ -182,7 +182,8 @@ class ZookeeperFixture(Fixture): class KafkaFixture(Fixture): @classmethod - def instance(cls, broker_id, zk_host, zk_port, zk_chroot=None, port=None, + def instance(cls, broker_id, zk_host, zk_port, zk_chroot=None, + host=None, port=None, transport='PLAINTEXT', replicas=1, partitions=2): if zk_chroot is None: zk_chroot = "kafka-python_" + str(uuid.uuid4()).replace("-", "_") @@ -207,7 +208,8 @@ class KafkaFixture(Fixture): # # Note that even though we specify the bind host in bracket notation, Kafka responds to the bootstrap # metadata request without square brackets later. - host = "[::1]" + if host is None: + host = "[::1]" fixture = KafkaFixture(host, port, broker_id, zk_host, zk_port, zk_chroot, transport=transport, |