summary refs log tree commit diff
path: root/tests/test_state.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* HTTP Replication Client (#15470)Jason Little2023-05-091-0/+1
| | | | | | Separate out a HTTP client for replication in preparation for also supporting using UNIX sockets. The major difference from the base class is that this does not use treq to handle HTTP requests.
* Add missing types to test_state. (#14985)Patrick Cloke2023-02-061-61/+137
|
* Faster room joins: avoid blocking when pulling events with missing prevs ↵Sean Quah2022-07-261-0/+2
| | | | | | | | | (#13355) Avoid blocking on full state in `_resolve_state_at_missing_prevs` and return a new flag indicating whether the resolved state is partial. Thread that flag around so that it makes it into the event context. Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Don't pull out the full state when storing state (#13274)Erik Johnston2022-07-151-0/+4
|
* Fix a bug which could lead to incorrect state (#13278)Erik Johnston2022-07-151-1/+41
| | | | | There are two fixes here: 1. A long-standing bug where we incorrectly calculated `delta_ids`; and 2. A bug introduced in #13267 where we got current state incorrect.
* Faster room joins: fix race in recalculation of current room state (#13151)Sean Quah2022-07-071-0/+2
| | | | | | | | | | | Bounce recalculation of current state to the correct event persister and move recalculation of current state into the event persistence queue, to avoid concurrent updates to a room's current state. Also give recalculation of a room's current state a real stream ordering. Signed-off-by: Sean Quah <seanq@matrix.org>
* Skip waiting for full state for incoming events (#13144)Richard van der Hoff2022-07-011-1/+3
| | | | | When we receive an event over federation during a faster join, there is no need to wait for full state, since we have a whole reconciliation process designed to take the partial state into account.
* Move the "email unsubscribe" resource, refactor the macaroon generator & ↵Quentin Gliech2022-06-141-2/+9
| | | | | | | | | | | | | | | | | | | | | simplify the access token verification logic. (#12986) This simplifies the access token verification logic by removing the `rights` parameter which was only ever used for the unsubscribe link in email notifications. The latter has been moved under the `/_synapse` namespace, since it is not a standard API. This also makes the email verification link more secure, by embedding the app_id and pushkey in the macaroon and verifying it. This prevents the user from tampering the query parameters of that unsubscribe link. Macaroon generation is refactored: - Centralised all macaroon generation and verification logic to the `MacaroonGenerator` - Moved to `synapse.utils` - Changed the constructor to require only a `Clock`, hostname, and a secret key (instead of a full `Homeserver`). - Added tests for all methods.
* Rename storage classes (#12913)Erik Johnston2022-05-311-3/+3
|
* Pull out less state when handling gaps mk2 (#12852)Erik Johnston2022-05-261-2/+12
|
* Update EventContext `get_current_event_ids` and `get_prev_event_ids` to ↵Shay2022-05-201-1/+1
| | | | accept state filters and update calls where possible (#12791)
* Refactor `resolve_state_groups_for_events` to not pull out full state when ↵Shay2022-05-181-0/+13
| | | | no state resolution happens. (#12775)
* Refactor `EventContext` (#12689)Erik Johnston2022-05-101-0/+3
| | | | | | | | | | Refactor how the `EventContext` class works, with the intention of reducing the amount of state we fetch from the DB during event processing. The idea here is to get rid of the cached `current_state_ids` and `prev_state_ids` that live in the `EventContext`, and instead defer straight to the database (and its caching). One change that may have a noticeable effect is that we now no longer prefill the `get_current_state_ids` cache on a state change. However, that query is relatively light, since its just a case of reading a table from the DB (unlike fetching state at an event which is more heavyweight). For deployments with workers this cache isn't even used. Part of #12684
* Faster joins: persist to database (#12012)Richard van der Hoff2022-03-011-27/+32
| | | | | | | | | | | | When we get a partial_state response from send_join, store information in the database about it: * store a record about the room as a whole having partial state, and stash the list of member servers too. * flag the join event itself as having partial state * also, for any new events whose prev-events are partial-stated, note that they will *also* be partial-stated. We don't yet make any attempt to interpret this data, so API calls (and a bunch of other things) are just going to get incorrect data.
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-2/+2
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Remove unnecessary parentheses around tuples returned from methods (#10889)Andrew Morgan2021-09-231-1/+1
|
* Add a module type for account validity (#9884)Brendan Abolivier2021-07-161-0/+1
| | | | | This adds an API for third-party plugin modules to implement account validity, so they can provide this feature instead of Synapse. The module implementing the current behaviour for this feature can be found at https://github.com/matrix-org/synapse-email-account-validity. To allow for a smooth transition between the current feature and the new module, hooks have been added to the existing account validity endpoints to allow their behaviours to be overridden by a module.
* Use inline type hints in `tests/` (#10350)Jonathan de Jong2021-07-131-1/+1
| | | | | | | | This PR is tantamount to running: python3.8 -m com2ann -v 6 tests/ (com2ann requires python 3.8 to run)
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Bump black configuration to target py36 (#9781)Dan Callahan2021-04-131-1/+1
| | | Signed-off-by: Dan Callahan <danc@element.io>
* Use mock from the stdlib. (#9772)Patrick Cloke2021-04-091-2/+1
|
* Bugbear: Add Mutable Parameter fixes (#9682)Jonathan de Jong2021-04-081-2/+3
| | | | | | | Part of #9366 Adds in fixes for B006 and B008, both relating to mutable parameter lint errors. Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>
* Add admin API for logging in as a user (#8617)Erik Johnston2020-11-171-0/+1
|
* Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke2020-09-181-1/+1
| | | | | | | This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-2/+2
|
* Do not yield on awaitables in tests. (#8193)Patrick Cloke2020-08-271-40/+46
|
* Convert a synapse.events to async/await. (#7949)Patrick Cloke2020-07-271-7/+7
|
* Convert state resolution to async/await (#7942)Patrick Cloke2020-07-241-28/+44
|
* Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)Patrick Cloke2020-02-211-13/+5
| | | | Ensure good comprehension hygiene using flake8-comprehensions.
* Add a `make_event_from_dict` method (#6858)Richard van der Hoff2020-02-071-2/+2
| | | | | | | ... and use it in places where it's trivial to do so. This will make it easier to pass room versions into the FrozenEvent constructors.
* s/get_room_version/get_room_version_id/Richard van der Hoff2020-01-311-1/+1
| | | | | ... to make way for a forthcoming get_room_version which returns a RoomVersion object.
* Change EventContext to use the Storage class (#6564)Erik Johnston2019-12-201-14/+14
|
* Fix bug which caused rejected events to be stored with the wrong room state ↵Richard van der Hoff2019-11-061-11/+50
| | | | | | | | | | | | (#6320) Fixes a bug where rejected events were persisted with the wrong state group. Also fixes an occasional internal-server-error when receiving events over federation which are rejected and (possibly because they are backwards-extremities) have no prev_group. Fixes #6289.
* Port to use state storageErik Johnston2019-10-301-0/+3
|
* Remove unnecessary parentheses around return statements (#5931)Andrew Morgan2019-08-301-1/+1
| | | | | Python will return a tuple whether there are parentheses around the returned values or not. I'm just sick of my editor complaining about this all over the place :)
* Run Black. (#5482)Amber Brown2019-06-201-3/+3
|
* Migrate all tests to use the dict-based config format instead of hanging ↵Amber Brown2019-05-131-1/+1
| | | | items off HomeserverConfig (#5171)
* Merge pull request #5027 from matrix-org/babolivier/account_expirationBrendan Abolivier2019-04-091-1/+3
|\ | | | | Add time-based account expiration
| * Add account expiration featureBrendan Abolivier2019-04-091-1/+3
| |
* | Collect room-version variations into one place (#4969)Richard van der Hoff2019-04-011-2/+3
|/ | | | Collect all the things that make room-versions different to one another into one place, so that it's easier to define new room versions.
* Port tests/ to Python 3 (#3808)Amber Brown2018-09-071-1/+1
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-08-201-151/+93
|\ | | | | | | erikj/refactor_state_handler
| * Run black.black2018-08-101-152/+93
| |
* | Fix testsErik Johnston2018-08-091-1/+5
|/
* Fix unit testsErik Johnston2018-07-231-12/+35
|
* run isortAmber Brown2018-07-091-5/+5
|
* Fix broken unit testRichard van der Hoff2018-06-141-2/+14
| | | | We need power levels for this test to do what it is supposed to do.
* Store state groups separately from events (#2784)Erik Johnston2018-02-061-66/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Split state group persist into seperate storage func * Add per database engine code for state group id gen * Move store_state_group to StateReadStore This allows other workers to use it, and so resolve state. * Hook up store_state_group * Fix tests * Rename _store_mult_state_groups_txn * Rename StateGroupReadStore * Remove redundant _have_persisted_state_group_txn * Update comments * Comment compute_event_context * Set start val for state_group_id_seq ... otherwise we try to recreate old state groups * Update comments * Don't store state for outliers * Update comment * Update docstring as state groups are ints
* Factor out resolve_state_groups to a separate handlerRichard van der Hoff2018-02-011-1/+3
| | | | | | We extract the storage-independent bits of the state group resolution out to a separate functiom, and stick it in a new handler, in preparation for its use from the storage layer.
* Fix typing testsErik Johnston2017-05-261-0/+2
|
* Correctly handle the difference between prev and current stateErik Johnston2016-08-311-23/+15
|
* Fix testsErik Johnston2016-08-261-5/+46
|
* Replace context.current_state with context.current_state_idsErik Johnston2016-08-251-47/+26
|
* Create log context in Measure if one doesn't existErik Johnston2016-04-181-2/+2
|
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* Fix an issue with ignoring power_level changes on divergent graphsRichard van der Hoff2015-11-121-0/+93
| | | | | | | | Changes to m.room.power_levels events are supposed to be handled at a high priority; however a typo meant that the relevant bit of code was never executed, so they were handled just like any other state change - which meant that a bad person could cause room state changes by forking the graph from a point in history when they were allowed to do so.
* Merge branch 'erikj/check_room_exists' into erikj/unfederatableErik Johnston2015-09-011-8/+29
|\
| * Fix testsErik Johnston2015-09-011-8/+29
| |
* | Check against sender rather than event_idErik Johnston2015-09-011-1/+1
|/
* Use dictionary cache to do group -> state fetchingErik Johnston2015-08-051-1/+1
|
* Fix testsErik Johnston2015-02-091-1/+6
|
* Implement new state resolution algorithmErik Johnston2015-01-211-71/+357
|
* Construct the EventContext in the state handler rather than constructing one ↵Mark Haines2014-12-161-14/+8
| | | | and then immediately calling state_handler.annotate_context_with_state
* Remove annotate_event_with_state as nothing was using it. Update state tests ↵Mark Haines2014-12-161-69/+39
| | | | to call annotate_context_with_state
* Rename annotate_state_groups to annotate_event_with_stateErik Johnston2014-11-111-6/+6
|
* Fix state testsErik Johnston2014-11-111-517/+176
|
* SPEC-7: Rename 'ts' to 'origin_server_ts'Mark Haines2014-10-171-1/+1
|
* Fixed test.Kegan Dougal2014-10-091-1/+0
|
* Still broken.Kegan Dougal2014-10-091-1/+2
|
* Break a test.Kegan Dougal2014-10-091-1/+1
|
* Fix unit test.Kegan Dougal2014-10-081-1/+1
|
* Break unit test.Kegan Dougal2014-10-081-1/+1
|
* Have all unit tests import from our own subclass of trial's unittest ↵Paul "LeoNerd" Evans2014-09-121-2/+1
| | | | TestCase; set up logging in ONE PLACE ONLY
* Make the state resolution use actual power levels rather than taking them ↵Erik Johnston2014-09-121-45/+140
| | | | from a Pdu key.
* Handle the case where we don't have a common ancestorErik Johnston2014-09-081-0/+24
|
* Fix bug in state handling where we incorrectly identified a missing pdu. ↵Erik Johnston2014-09-081-15/+218
| | | | Update tests to catch this case.
* Fix state unit testErik Johnston2014-09-061-0/+1
|
* fix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org ↵Matthew Hodgson2014-09-031-1/+1
| | | | hasn't been incorporated in time for launch.
* Start updating state handling to use snapshotsMark Haines2014-08-271-7/+10
|
* Fix some of the tests to reflect changes in the storage layer.Erik Johnston2014-08-151-2/+2
|
* Add a check to make sure that during state conflict res we only request a ↵Erik Johnston2014-08-151-0/+3
| | | | PDU we don't have.
* add in copyrights to everything, not just the synapse subdir, and add a ↵Matthew Hodgson2014-08-131-0/+14
| | | | copyrighter.pl whilst we're at it
* Reference Matrix Home Servermatrix.org2014-08-121-0/+271