summaryrefslogtreecommitdiff
path: root/test/test_conn.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-03-30 17:21:20 -0700
committerDana Powers <dana.powers@gmail.com>2016-03-30 17:21:20 -0700
commitb96f4ccf070109a022deb98b569e61d23e4e75b9 (patch)
treeb899ac53627c6b169ddc6e41072502e3cb30185f /test/test_conn.py
parentc6c862ad29ec5d0ae61d635c2020fb925b405c44 (diff)
parentf456ffc8d95d04b0381dc07cf2ae113043f3c887 (diff)
downloadkafka-python-b96f4ccf070109a022deb98b569e61d23e4e75b9.tar.gz
Merge pull request #615 from TimEvens/master
Kafka IPv6 Support.
Diffstat (limited to 'test/test_conn.py')
-rw-r--r--test/test_conn.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/test/test_conn.py b/test/test_conn.py
index 684ffe5..f0ef8fb 100644
--- a/test/test_conn.py
+++ b/test/test_conn.py
@@ -51,21 +51,37 @@ class ConnTest(unittest.TestCase):
results = collect_hosts(hosts)
self.assertEqual(set(results), set([
- ('localhost', 1234),
- ('localhost', 9092),
+ ('localhost', 1234, socket.AF_INET),
+ ('localhost', 9092, socket.AF_INET),
+ ]))
+
+ def test_collect_hosts__ipv6(self):
+ hosts = "[localhost]:1234,[2001:1000:2000::1],[2001:1000:2000::1]:1234"
+ results = collect_hosts(hosts)
+
+ self.assertEqual(set(results), set([
+ ('localhost', 1234, socket.AF_INET6),
+ ('2001:1000:2000::1', 9092, socket.AF_INET6),
+ ('2001:1000:2000::1', 1234, socket.AF_INET6),
]))
def test_collect_hosts__string_list(self):
hosts = [
'localhost:1234',
'localhost',
+ '[localhost]',
+ '2001::1',
+ '[2001::1]:1234',
]
results = collect_hosts(hosts)
self.assertEqual(set(results), set([
- ('localhost', 1234),
- ('localhost', 9092),
+ ('localhost', 1234, socket.AF_INET),
+ ('localhost', 9092, socket.AF_INET),
+ ('localhost', 9092, socket.AF_INET6),
+ ('2001::1', 9092, socket.AF_INET6),
+ ('2001::1', 1234, socket.AF_INET6),
]))
def test_collect_hosts__with_spaces(self):
@@ -73,10 +89,11 @@ class ConnTest(unittest.TestCase):
results = collect_hosts(hosts)
self.assertEqual(set(results), set([
- ('localhost', 1234),
- ('localhost', 9092),
+ ('localhost', 1234, socket.AF_INET),
+ ('localhost', 9092, socket.AF_INET),
]))
+
def test_send(self):
self.conn.send(self.config['request_id'], self.config['payload'])
self.conn._sock.sendall.assert_called_with(self.config['payload'])