diff options
author | James Brown <jbrown@easypost.com> | 2016-04-11 16:52:35 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2016-04-24 16:20:22 -0700 |
commit | 434802dfa17f8c9d6b17b02d12bf0f7bee6240cd (patch) | |
tree | 9eced0688e60bb9f16f28aa6a99676be2bc4e54d /test/test_conn_legacy.py | |
parent | a12be0af80a1c0903eb92566e75a63bcec988806 (diff) | |
download | kafka-python-434802dfa17f8c9d6b17b02d12bf0f7bee6240cd.tar.gz |
More thorough IPv6 support that uses getaddrinfo to resolve names
Fixes #641
Diffstat (limited to 'test/test_conn_legacy.py')
-rw-r--r-- | test/test_conn_legacy.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/test_conn_legacy.py b/test/test_conn_legacy.py index 347588e..820c4e7 100644 --- a/test/test_conn_legacy.py +++ b/test/test_conn_legacy.py @@ -48,12 +48,12 @@ class ConnTest(unittest.TestCase): self.MockCreateConn.reset_mock() def test_collect_hosts__happy_path(self): - hosts = "localhost:1234,localhost" + hosts = "127.0.0.1:1234,127.0.0.1" results = collect_hosts(hosts) self.assertEqual(set(results), set([ - ('localhost', 1234, socket.AF_INET), - ('localhost', 9092, socket.AF_INET), + ('127.0.0.1', 1234, socket.AF_INET), + ('127.0.0.1', 9092, socket.AF_INET), ])) def test_collect_hosts__ipv6(self): @@ -72,16 +72,18 @@ class ConnTest(unittest.TestCase): 'localhost', '[localhost]', '2001::1', + '[2001::1]', '[2001::1]:1234', ] results = collect_hosts(hosts) self.assertEqual(set(results), set([ - ('localhost', 1234, socket.AF_INET), - ('localhost', 9092, socket.AF_INET), + ('localhost', 1234, socket.AF_UNSPEC), + ('localhost', 9092, socket.AF_UNSPEC), ('localhost', 9092, socket.AF_INET6), ('2001::1', 9092, socket.AF_INET6), + ('2001::1', 9092, socket.AF_INET6), ('2001::1', 1234, socket.AF_INET6), ])) @@ -90,8 +92,8 @@ class ConnTest(unittest.TestCase): results = collect_hosts(hosts) self.assertEqual(set(results), set([ - ('localhost', 1234, socket.AF_INET), - ('localhost', 9092, socket.AF_INET), + ('localhost', 1234, socket.AF_UNSPEC), + ('localhost', 9092, socket.AF_UNSPEC), ])) |