summary refs log tree commit diff
path: root/tests/storage/test_keys.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Modify StoreKeyFetcher to read from server_keys_json. (#15417)Patrick Cloke2023-04-201-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change: * `PerspectivesKeyFetcher` and `ServerKeyFetcher` write to `server_keys_json`. * `PerspectivesKeyFetcher` also writes to `server_signature_keys`. * `StoreKeyFetcher` reads from `server_signature_keys`. After this change: * `PerspectivesKeyFetcher` and `ServerKeyFetcher` write to `server_keys_json`. * `PerspectivesKeyFetcher` also writes to `server_signature_keys`. * `StoreKeyFetcher` reads from `server_keys_json`. This results in `StoreKeyFetcher` now using the results from `ServerKeyFetcher` in addition to those from `PerspectivesKeyFetcher`, i.e. keys which are directly fetched from a server will now be pulled from the database instead of refetched. An additional minor change is included to avoid creating a `PerspectivesKeyFetcher` (and checking it) if no `trusted_key_servers` are configured. The overall impact of this should be better usage of cached results: * If a server has no trusted key servers configured then it should reduce how often keys are fetched. * if a server's trusted key server does not have a requested server's keys cached then it should reduce how often keys are directly fetched.
* Improve robustness when handling a perspective key response by deduplicating ↵reivilibre2023-04-131-9/+9
| | | | | | | | | | | | | | | received server keys. (#15423) * Change `store_server_verify_keys` to take a `Mapping[(str, str), FKR]` This is because we already can't handle duplicate keys — leads to cardinality violation * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> --------- Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* Add final type hint to tests.unittest. (#15072)Patrick Cloke2023-02-141-28/+33
| | | | Adds a return type to HomeServerTestCase.make_homeserver and deal with any variables which are no longer Any.
* Require types in tests.storage. (#14646)Patrick Cloke2022-12-091-3/+6
| | | | Adds missing type hints to `tests.storage` package and does not allow untyped definitions.
* 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 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>`
* Type defintions for use in refactoring for redaction changes (#6803)Richard van der Hoff2020-01-301-4/+11
| | | | | | | | | | * Bump signedjson to 1.1 ... so that we can use the type definitions * Fix breakage caused by upgrade to signedjson 1.1 Thanks, @illicitonion...
* Store key validity time in the storage layerRichard van der Hoff2019-05-231-14/+30
| | | | | | | | This is a first step to checking that the key is valid at the required moment. The idea here is that, rather than passing VerifyKey objects in and out of the storage layer, we instead pass FetchKeyResult objects, which simply wrap the VerifyKey and add a valid_until_ts field.
* Rewrite store_server_verify_key to store several keys at once (#5234)Richard van der Hoff2019-05-231-14/+30
| | | | | Storing server keys hammered the database a bit. This replaces the implementation which stored a single key, with one which can do many updates at once.
* Rewrite Datastore.get_server_verify_keysRichard van der Hoff2019-04-091-3/+50
| | | | Rewrite this so that it doesn't hammer the database.
* Rewrite test_keys as a HomeserverTestCaseRichard van der Hoff2019-04-081-19/+15
|
* Fix flake8 (#4519)Amber Brown2019-01-301-3/+0
|
* Run tests under PostgreSQL (#3423)Amber Brown2018-08-131-1/+1
|
* Run black.black2018-08-101-7/+4
|
* run isortAmber Brown2018-07-091-0/+1
|
* Fix caching of remote servers' signature keysRichard van der Hoff2017-03-221-0/+53
The `@cached` decorator on `KeyStore._get_server_verify_key` was missing its `num_args` parameter, which meant that it was returning the wrong key for any server which had more than one recorded key. By way of a fix, change the default for `num_args` to be *all* arguments. To implement that, factor out a common base class for `CacheDescriptor` and `CacheListDescriptor`.