Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

SHHS - Room Join Complexity #5072

Merged
merged 50 commits into from
May 20, 2019
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
ab904c1
temp
hawkowl Apr 16, 2019
cac8907
initial
hawkowl Apr 16, 2019
b381f0f
test
hawkowl Apr 17, 2019
e22e7fa
Merge remote-tracking branch 'origin/develop' into hawkowl/shhs-join-…
hawkowl Apr 17, 2019
269166a
cleanup
hawkowl Apr 17, 2019
aa19990
changelog
hawkowl Apr 17, 2019
b04a635
move to the federation server
hawkowl Apr 17, 2019
817f28a
Remove Python 2.7 testing, to speed things up on SHHS.
hawkowl Apr 17, 2019
04525e9
fixes
hawkowl Apr 17, 2019
cdd5cf0
fixes
hawkowl Apr 17, 2019
10bf9de
tests + preflight check
hawkowl Apr 23, 2019
08180cc
isort
hawkowl Apr 23, 2019
6305ddb
implement post-leave
hawkowl Apr 24, 2019
d436868
fix builds
hawkowl Apr 24, 2019
1cb467c
fix
hawkowl Apr 24, 2019
4c93938
py2 backport division
hawkowl Apr 24, 2019
b9d9a98
Merge remote-tracking branch 'origin/shhs' into hawkowl/shhs-join-com…
hawkowl Apr 25, 2019
4687115
Merge remote-tracking branch 'origin/develop' into hawkowl/shhs-join-…
hawkowl May 8, 2019
ee8605d
Merge remote-tracking branch 'origin/develop' into hawkowl/shhs-join-…
hawkowl May 8, 2019
cc35f21
review comment
hawkowl May 8, 2019
92f71d4
review comment
hawkowl May 8, 2019
580b01f
Merge remote-tracking branch 'origin/shhs' into hawkowl/shhs-join-com…
hawkowl May 8, 2019
2a1e5da
fix
hawkowl May 8, 2019
bd18134
fix
hawkowl May 10, 2019
b8365a6
Merge remote-tracking branch 'origin/develop' into hawkowl/test-confi…
hawkowl May 10, 2019
cafe839
fixes, porting
hawkowl May 10, 2019
d963a11
fixes, porting
hawkowl May 10, 2019
ec3d07c
changelog
hawkowl May 10, 2019
1ba0ecc
finish porting
hawkowl May 10, 2019
338bc44
Merge remote-tracking branch 'origin/develop' into hawkowl/shhs-join-…
hawkowl May 13, 2019
1c9b773
Merge branch 'hawkowl/test-config-parse' into hawkowl/shhs-join-compl…
hawkowl May 13, 2019
e9df0df
Merge remote-tracking branch 'origin/shhs' into hawkowl/shhs-join-com…
hawkowl May 13, 2019
d86ea48
update ratelimiting
hawkowl May 13, 2019
b099b86
remove old uses of the config obj
hawkowl May 13, 2019
451fbf0
remove the federation rc from tests
hawkowl May 13, 2019
d74dfa2
fix
hawkowl May 13, 2019
dac602c
fix
hawkowl May 13, 2019
ce5d662
black
hawkowl May 13, 2019
9eb2cac
Merge branch 'hawkowl/ratelimit-consistency' into hawkowl/shhs-join-c…
hawkowl May 14, 2019
41c33a0
fix
hawkowl May 14, 2019
e07c6b9
fix
hawkowl May 15, 2019
f7f8150
split out, clean up
hawkowl May 15, 2019
2c31a96
cleanup
hawkowl May 15, 2019
b9433d7
Merge remote-tracking branch 'origin/shhs' into hawkowl/shhs-join-com…
hawkowl May 16, 2019
906a13a
cleanup
hawkowl May 16, 2019
e24d09d
Merge remote-tracking branch 'origin/develop' into hawkowl/shhs-join-…
hawkowl May 20, 2019
a6fd6e4
review fixes
hawkowl May 20, 2019
1994d2a
fix
hawkowl May 20, 2019
41c224b
Merge remote-tracking branch 'origin/shhs' into hawkowl/shhs-join-com…
hawkowl May 20, 2019
27021cd
Update pyproject.toml
hawkowl May 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
finish porting
  • Loading branch information
hawkowl committed May 10, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 1ba0ecc6ecd45b5de91a998e58e90f2dce11c06b
1 change: 1 addition & 0 deletions synapse/rest/media/v1/storage_provider.py
Original file line number Diff line number Diff line change
@@ -108,6 +108,7 @@ class FileStorageProviderBackend(StorageProvider):
"""

def __init__(self, hs, config):
self.hs = hs
self.cache_directory = hs.config.media_store_path
self.base_directory = config

6 changes: 5 additions & 1 deletion tests/handlers/test_register.py
Original file line number Diff line number Diff line change
@@ -37,8 +37,12 @@ def make_homeserver(self, reactor, clock):
hs_config = self.default_config("test")

# some of the tests rely on us having a user consent version
hs_config["user_consent"] = {"version": "test_consent_version"}
hs_config["user_consent"] = {
"version": "test_consent_version",
"template_dir": ".",
}
hs_config["max_mau_value"] = 50
hs_config["limit_usage_by_mau"] = True

hs = self.setup_test_homeserver(config=hs_config, expire_access_token=True)
return hs
4 changes: 3 additions & 1 deletion tests/http/federation/test_matrix_federation_agent.py
Original file line number Diff line number Diff line change
@@ -54,7 +54,9 @@ def setUp(self):

self.agent = MatrixFederationAgent(
reactor=self.reactor,
tls_client_options_factory=ClientTLSOptionsFactory(default_config("test")),
tls_client_options_factory=ClientTLSOptionsFactory(
default_config("test", parse=True)
),
_well_known_tls_policy=TrustingTLSPolicyForHTTPS(),
_srv_resolver=self.mock_resolver,
_well_known_cache=self.well_known_cache,
36 changes: 20 additions & 16 deletions tests/push/test_email.py
Original file line number Diff line number Diff line change
@@ -52,22 +52,26 @@ def sendmail(*args, **kwargs):
return d

config = self.default_config()
config.email_enable_notifs = True
config.start_pushers = True

config.email_template_dir = os.path.abspath(
pkg_resources.resource_filename('synapse', 'res/templates')
)
config.email_notif_template_html = "notif_mail.html"
config.email_notif_template_text = "notif_mail.txt"
config.email_smtp_host = "127.0.0.1"
config.email_smtp_port = 20
config.require_transport_security = False
config.email_smtp_user = None
config.email_smtp_pass = None
config.email_app_name = "Matrix"
config.email_notif_from = "test@example.com"
config.email_riot_base_url = None
config["email"] = {
"enable_notifs": True,
"template_dir": os.path.abspath(
pkg_resources.resource_filename('synapse', 'res/templates')
),
"expiry_template_html": "notice_expiry.html",
"expiry_template_text": "notice_expiry.txt",
"notif_template_html": "notif_mail.html",
"notif_template_text": "notif_mail.txt",
"smtp_host": "127.0.0.1",
"smtp_port": 20,
"require_transport_security": False,
"smtp_user": None,
"smtp_pass": None,
"app_name": "Matrix",
"notif_from": "test@example.com",
"riot_base_url": None,
}
config["public_baseurl"] = "aaa"
config["start_pushers"] = True

hs = self.setup_test_homeserver(config=config, sendmail=sendmail)

17 changes: 10 additions & 7 deletions tests/rest/client/v2_alpha/test_register.py
Original file line number Diff line number Diff line change
@@ -325,15 +325,18 @@ def sendmail(*args, **kwargs):
"template_dir": os.path.abspath(
pkg_resources.resource_filename('synapse', 'res/templates')
),
"email_expiry_template_html": "notice_expiry.html",
"email_expiry_template_text": "notice_expiry.txt",
"email_smtp_host": "127.0.0.1",
"email_smtp_port": 20,
"expiry_template_html": "notice_expiry.html",
"expiry_template_text": "notice_expiry.txt",
"notif_template_html": "notif_mail.html",
"notif_template_text": "notif_mail.txt",
"smtp_host": "127.0.0.1",
"smtp_port": 20,
"require_transport_security": False,
"email_smtp_user": None,
"email_smtp_pass": None,
"email_notif_from": "test@example.com",
"smtp_user": None,
"smtp_pass": None,
"notif_from": "test@example.com",
}
config["public_baseurl"] = "aaa"

self.hs = self.setup_test_homeserver(config=config, sendmail=sendmail)

6 changes: 3 additions & 3 deletions tests/rest/media/v1/test_media_storage.py
Original file line number Diff line number Diff line change
@@ -25,13 +25,11 @@
from twisted.internet import defer, reactor
from twisted.internet.defer import Deferred

from synapse.config.repository import MediaStorageProviderConfig
from synapse.rest.media.v1._base import FileInfo
from synapse.rest.media.v1.filepath import MediaFilePaths
from synapse.rest.media.v1.media_storage import MediaStorage
from synapse.rest.media.v1.storage_provider import FileStorageProviderBackend
from synapse.util.logcontext import make_deferred_yieldable
from synapse.util.module_loader import load_module

from tests import unittest

@@ -120,10 +118,12 @@ def write_to(r):
client.get_file = get_file

self.storage_path = self.mktemp()
self.media_store_path = self.mktemp()
os.mkdir(self.storage_path)
os.mkdir(self.media_store_path)

config = self.default_config()
config["media_store_path"] = self.storage_path
config["media_store_path"] = self.media_store_path
config["thumbnail_requirements"] = {}
config["max_image_pixels"] = 2000000

14 changes: 6 additions & 8 deletions tests/rest/media/v1/test_url_preview.py
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@
import os

import attr
from netaddr import IPSet

from twisted.internet._resolver import HostResolution
from twisted.internet.address import IPv4Address, IPv6Address
@@ -25,9 +24,6 @@
from twisted.test.proto_helpers import AccumulatingProtocol
from twisted.web._newclient import ResponseDone

from synapse.config.repository import MediaStorageProviderConfig
from synapse.util.module_loader import load_module

from tests import unittest
from tests.server import FakeTransport

@@ -67,9 +63,6 @@ class URLPreviewTests(unittest.HomeserverTestCase):

def make_homeserver(self, reactor, clock):

self.storage_path = self.mktemp()
os.mkdir(self.storage_path)

config = self.default_config()
config["url_preview_enabled"] = True
config["max_spider_size"] = 9999999
@@ -81,7 +74,12 @@ def make_homeserver(self, reactor, clock):
)
config["url_preview_ip_range_whitelist"] = ("1.1.1.1",)
config["url_preview_url_blacklist"] = []
config["media_store_path"] = self.storage_path

self.storage_path = self.mktemp()
self.media_store_path = self.mktemp()
os.mkdir(self.storage_path)
os.mkdir(self.media_store_path)
config["media_store_path"] = self.media_store_path

provider_config = {
"module": "synapse.rest.media.v1.storage_provider.FileStorageProviderBackend",
61 changes: 34 additions & 27 deletions tests/server.py
Original file line number Diff line number Diff line change
@@ -227,6 +227,8 @@ class ThreadedMemoryReactorClock(MemoryReactorClock):
"""

def __init__(self):
self.threadpool = ThreadPool(self)

self._udp = []
lookups = self.lookups = {}

@@ -255,6 +257,37 @@ def callFromThread(self, callback, *args, **kwargs):
self.callLater(0, d.callback, True)
return d

def getThreadPool(self):
return self.threadpool


class ThreadPool:
"""
Threadless thread pool.
"""

def __init__(self, reactor):
self._reactor = reactor

def start(self):
pass

def stop(self):
pass

def callInThreadWithCallback(self, onResult, function, *args, **kwargs):
def _(res):
if isinstance(res, Failure):
onResult(False, res)
else:
onResult(True, res)

d = Deferred()
d.addCallback(lambda x: function(*args, **kwargs))
d.addBoth(_)
self._reactor.callLater(0, d.callback, True)
return d


def setup_test_homeserver(cleanup_func, *args, **kwargs):
"""
@@ -290,36 +323,10 @@ def runInteraction(interaction, *args, **kwargs):
**kwargs
)

class ThreadPool:
"""
Threadless thread pool.
"""

def start(self):
pass

def stop(self):
pass

def callInThreadWithCallback(self, onResult, function, *args, **kwargs):
def _(res):
if isinstance(res, Failure):
onResult(False, res)
else:
onResult(True, res)

d = Deferred()
d.addCallback(lambda x: function(*args, **kwargs))
d.addBoth(_)
clock._reactor.callLater(0, d.callback, True)
return d

clock.threadpool = ThreadPool()

if pool:
pool.runWithConnection = runWithConnection
pool.runInteraction = runInteraction
pool.threadpool = ThreadPool()
pool.threadpool = ThreadPool(clock._reactor)
pool.running = True
return d