mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-22 20:50:23 +03:00
make replication tests pass on OSX
This commit is contained in:
parent
36da256cc6
commit
3f79378d4b
1 changed files with 6 additions and 2 deletions
|
@ -15,6 +15,8 @@
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer, reactor
|
||||||
from tests import unittest
|
from tests import unittest
|
||||||
|
|
||||||
|
import tempfile
|
||||||
|
|
||||||
from mock import Mock, NonCallableMock
|
from mock import Mock, NonCallableMock
|
||||||
from tests.utils import setup_test_homeserver
|
from tests.utils import setup_test_homeserver
|
||||||
from synapse.replication.tcp.resource import ReplicationStreamProtocolFactory
|
from synapse.replication.tcp.resource import ReplicationStreamProtocolFactory
|
||||||
|
@ -41,7 +43,9 @@ class BaseSlavedStoreTestCase(unittest.TestCase):
|
||||||
self.event_id = 0
|
self.event_id = 0
|
||||||
|
|
||||||
server_factory = ReplicationStreamProtocolFactory(self.hs)
|
server_factory = ReplicationStreamProtocolFactory(self.hs)
|
||||||
listener = reactor.listenUNIX("\0xxx", server_factory)
|
# XXX: mktemp is unsafe and should never be used. but we're just a test.
|
||||||
|
path = tempfile.mktemp(prefix="base_slaved_store_test_case_socket")
|
||||||
|
listener = reactor.listenUNIX(path, server_factory)
|
||||||
self.addCleanup(listener.stopListening)
|
self.addCleanup(listener.stopListening)
|
||||||
self.streamer = server_factory.streamer
|
self.streamer = server_factory.streamer
|
||||||
|
|
||||||
|
@ -49,7 +53,7 @@ class BaseSlavedStoreTestCase(unittest.TestCase):
|
||||||
client_factory = ReplicationClientFactory(
|
client_factory = ReplicationClientFactory(
|
||||||
self.hs, "client_name", self.replication_handler
|
self.hs, "client_name", self.replication_handler
|
||||||
)
|
)
|
||||||
client_connector = reactor.connectUNIX("\0xxx", client_factory)
|
client_connector = reactor.connectUNIX(path, client_factory)
|
||||||
self.addCleanup(client_factory.stopTrying)
|
self.addCleanup(client_factory.stopTrying)
|
||||||
self.addCleanup(client_connector.disconnect)
|
self.addCleanup(client_connector.disconnect)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue