summary refs log tree commit diff
path: root/tests/http/federation/test_srv_resolver.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-08-08 15:30:04 +0100
committerErik Johnston <erik@matrix.org>2019-08-15 15:43:22 +0100
commitf299c5414c2dd300103b0e11e7114123d8eb58a1 (patch)
tree293dbffbf79c0df1b322700015764f322b3b1f48 /tests/http/federation/test_srv_resolver.py
parentMerge branch 'master' into develop (diff)
downloadsynapse-f299c5414c2dd300103b0e11e7114123d8eb58a1.tar.xz
Refactor MatrixFederationAgent to retry SRV.
This refactors MatrixFederationAgent to move the SRV lookup into the
endpoint code, this has two benefits:
	1. Its easier to retry different host/ports in the same way as
	   HostnameEndpoint.
	2. We avoid SRV lookups if we have a free connection in the pool
Diffstat (limited to 'tests/http/federation/test_srv_resolver.py')
-rw-r--r--tests/http/federation/test_srv_resolver.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/http/federation/test_srv_resolver.py b/tests/http/federation/test_srv_resolver.py
index 3b885ef64b..df034ab237 100644
--- a/tests/http/federation/test_srv_resolver.py
+++ b/tests/http/federation/test_srv_resolver.py
@@ -83,8 +83,10 @@ class SrvResolverTestCase(unittest.TestCase):
 
         service_name = b"test_service.example.com"
 
-        entry = Mock(spec_set=["expires"])
+        entry = Mock(spec_set=["expires", "priority", "weight"])
         entry.expires = 0
+        entry.priority = 0
+        entry.weight = 0
 
         cache = {service_name: [entry]}
         resolver = SrvResolver(dns_client=dns_client_mock, cache=cache)
@@ -105,8 +107,10 @@ class SrvResolverTestCase(unittest.TestCase):
 
         service_name = b"test_service.example.com"
 
-        entry = Mock(spec_set=["expires"])
+        entry = Mock(spec_set=["expires", "priority", "weight"])
         entry.expires = 999999999
+        entry.priority = 0
+        entry.weight = 0
 
         cache = {service_name: [entry]}
         resolver = SrvResolver(