diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-04-09 23:40:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-09 23:40:06 +0100 |
commit | 664adb4236d911d6b1619b8aa8489d99772ea86b (patch) | |
tree | 25d55210844c8e7457451737492fcdfd81856697 /tests | |
parent | Merge pull request #3069 from krombel/update_prometheus_config (diff) | |
parent | Remove address resolution of hosts in SRV records (diff) | |
download | synapse-664adb4236d911d6b1619b8aa8489d99772ea86b.tar.xz |
Merge pull request #3016 from silkeh/improve-service-lookups
Improve handling of SRV records for federation connections
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_dns.py | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/tests/test_dns.py b/tests/test_dns.py index d08b0f4333..af607d626f 100644 --- a/tests/test_dns.py +++ b/tests/test_dns.py @@ -33,8 +33,6 @@ class DnsTestCase(unittest.TestCase): service_name = "test_service.example.com" host_name = "example.com" - ip_address = "127.0.0.1" - ip6_address = "::1" answer_srv = dns.RRHeader( type=dns.SRV, @@ -43,29 +41,9 @@ class DnsTestCase(unittest.TestCase): ) ) - answer_a = dns.RRHeader( - type=dns.A, - payload=dns.Record_A( - address=ip_address, - ) - ) - - answer_aaaa = dns.RRHeader( - type=dns.AAAA, - payload=dns.Record_AAAA( - address=ip6_address, - ) - ) - dns_client_mock.lookupService.return_value = defer.succeed( ([answer_srv], None, None), ) - dns_client_mock.lookupAddress.return_value = defer.succeed( - ([answer_a], None, None), - ) - dns_client_mock.lookupIPV6Address.return_value = defer.succeed( - ([answer_aaaa], None, None), - ) cache = {} @@ -74,13 +52,10 @@ class DnsTestCase(unittest.TestCase): ) dns_client_mock.lookupService.assert_called_once_with(service_name) - dns_client_mock.lookupAddress.assert_called_once_with(host_name) - dns_client_mock.lookupIPV6Address.assert_called_once_with(host_name) - self.assertEquals(len(servers), 2) + self.assertEquals(len(servers), 1) self.assertEquals(servers, cache[service_name]) - self.assertEquals(servers[0].host, ip_address) - self.assertEquals(servers[1].host, ip6_address) + self.assertEquals(servers[0].host, host_name) @defer.inlineCallbacks def test_from_cache_expired_and_dns_fail(self): |