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

Add a mechanism for per-test configs #5657

Merged
merged 2 commits into from
Jul 12, 2019
Merged

Add a mechanism for per-test configs #5657

merged 2 commits into from
Jul 12, 2019

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Jul 10, 2019

It's useful to be able to tweak the homeserver config to be used for each test. This PR adds a mechanism to do so.

It's useful to be able to tweak the homeserver config to be used for each
test. This PR adds a mechanism to do so.
@richvdh richvdh requested a review from a team July 10, 2019 14:45
@hawkowl
Copy link
Contributor

hawkowl commented Jul 11, 2019

I also added a mechanism in the backoff PR -- https://github.com/matrix-org/synapse/pull/5556/files#diff-9161fd33123787f063a0f71aad7c3272R382 -- obviously we should pick one of them :)

I'm not in love with attaching objects to functions, personally, so IDK.

@richvdh
Copy link
Member Author

richvdh commented Jul 11, 2019

Well, obviously we should land this one, because it's not tied up into a larger, more contentious, PR ;)

Building a config, configuring the HS, and then reconfiguring the HS feels like a bit of a funny way of doing things to me.

I agree that attaching things to functions isn't super-lovely either, though in practice (https://github.com/matrix-org/synapse/pull/5660/files#diff-afaefb43d2d504f504fb4d4a8840e70eR222) it felt quite usable.

Perhaps a casting vote? @erikjohnston ?

@hawkowl
Copy link
Contributor

hawkowl commented Jul 11, 2019

@richvdh a side effect of doing my method in our tests is that we can start potentially exercising in-production-SIGHUP reconfiguration changes of more than just our logs, which might be valuable?

but yes lets make @erikjohnston make all the big decisions for us, so we can blame him :D

@richvdh
Copy link
Member Author

richvdh commented Jul 11, 2019

we can start potentially exercising in-production-SIGHUP reconfiguration changes of more than just our logs, which might be valuable?

it would indeed, though I'm not convinced I'd want to end up doing that process for lots of unit tests.

@erikjohnston
Copy link
Member

I'm not a fan of attaching attributes to functions, what about using a decorator?

@override_config(enable_registration=False, ...)
def test_foo(self):
   ...

@erikjohnston
Copy link
Member

I also think that relying on reload_config is a bit annoying if you want to change config for stuff that can't be reloaded. So I vote decorators, then maybe this PR.

@codecov
Copy link

codecov bot commented Jul 11, 2019

Codecov Report

Merging #5657 into develop will increase coverage by 0.04%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop    #5657      +/-   ##
===========================================
+ Coverage    63.22%   63.26%   +0.04%     
===========================================
  Files          331      328       -3     
  Lines        36037    35853     -184     
  Branches      5931     5909      -22     
===========================================
- Hits         22784    22684     -100     
+ Misses       11623    11545      -78     
+ Partials      1630     1624       -6

@richvdh
Copy link
Member Author

richvdh commented Jul 11, 2019

ok, I have implemented erik's plan.

@richvdh richvdh merged commit 6bb0357 into develop Jul 12, 2019
@richvdh richvdh deleted the rav/per_test_configs branch July 12, 2019 09:16
anoadragon453 added a commit that referenced this pull request Jul 22, 2019
v1.2.0rc1

Features
--------

- Add support for opentracing. ([\#5544](#5544), [\#5712](#5712))
- Add ability to pull all locally stored events out of synapse that a particular user can see. ([\#5589](#5589))
- Add a basic admin command app to allow server operators to run Synapse admin commands separately from the main production instance. ([\#5597](#5597))
- Add `sender` and `origin_server_ts` fields to `m.replace`. ([\#5613](#5613))
- Add default push rule to ignore reactions. ([\#5623](#5623))
- Include the original event when asking for its relations. ([\#5626](#5626))
- Implement `session_lifetime` configuration option, after which access tokens will expire. ([\#5660](#5660))
- Return "This account has been deactivated" when a deactivated user tries to login. ([\#5674](#5674))
- Enable aggregations support by default ([\#5714](#5714))

Bugfixes
--------

- Fix 'utime went backwards' errors on daemonization. ([\#5609](#5609))
- Various minor fixes to the federation request rate limiter. ([\#5621](#5621))
- Forbid viewing relations on an event once it has been redacted. ([\#5629](#5629))
- Fix requests to the `/store_invite` endpoint of identity servers being sent in the wrong format. ([\#5638](#5638))
- Fix newly-registered users not being able to lookup their own profile without joining a room. ([\#5644](#5644))
- Fix bug in #5626 that prevented the original_event field from actually having the contents of the original event in a call to `/relations`. ([\#5654](#5654))
- Fix 3PID bind requests being sent to identity servers as `application/x-form-www-urlencoded` data, which is deprecated. ([\#5658](#5658))
- Fix some problems with authenticating redactions in recent room versions. ([\#5699](#5699), [\#5700](#5700), [\#5707](#5707))
- Ignore redactions of m.room.create events. ([\#5701](#5701))

Updates to the Docker image
---------------------------

- Base Docker image on a newer Alpine Linux version (3.8 -> 3.10). ([\#5619](#5619))
- Add missing space in default logging file format generated by the Docker image. ([\#5620](#5620))

Improved Documentation
----------------------

- Add information about nginx normalisation to reverse_proxy.rst. Contributed by @skalarproduktraum - thanks! ([\#5397](#5397))
- --no-pep517 should be --no-use-pep517 in the documentation to setup the development environment. ([\#5651](#5651))
- Improvements to Postgres setup instructions. Contributed by @Lrizika - thanks! ([\#5661](#5661))
- Minor tweaks to postgres documentation. ([\#5675](#5675))

Deprecations and Removals
-------------------------

- Remove support for the `invite_3pid_guest` configuration setting. ([\#5625](#5625))

Internal Changes
----------------

- Move logging code out of `synapse.util` and into `synapse.logging`. ([\#5606](#5606), [\#5617](#5617))
- Add a blacklist file to the repo to blacklist certain sytests from failing CI. ([\#5611](#5611))
- Make runtime errors surrounding password reset emails much clearer. ([\#5616](#5616))
- Remove dead code for persiting outgoing federation transactions. ([\#5622](#5622))
- Add `lint.sh` to the scripts-dev folder which will run all linting steps required by CI. ([\#5627](#5627))
- Move RegistrationHandler.get_or_create_user to test code. ([\#5628](#5628))
- Add some more common python virtual-environment paths to the black exclusion list. ([\#5630](#5630))
- Some counter metrics exposed over Prometheus have been renamed, with the old names preserved for backwards compatibility and deprecated. See `docs/metrics-howto.rst` for details. ([\#5636](#5636))
- Unblacklist some user_directory sytests. ([\#5637](#5637))
- Factor out some redundant code in the login implementation. ([\#5639](#5639))
- Update ModuleApi to avoid register(generate_token=True). ([\#5640](#5640))
- Remove access-token support from `RegistrationHandler.register`, and rename it. ([\#5641](#5641))
- Remove access-token support from `RegistrationStore.register`, and rename it. ([\#5642](#5642))
- Improve logging for auto-join when a new user is created. ([\#5643](#5643))
- Remove unused and unnecessary check for FederationDeniedError in _exception_to_failure. ([\#5645](#5645))
- Fix a small typo in a code comment. ([\#5655](#5655))
- Clean up exception handling around client access tokens. ([\#5656](#5656))
- Add a mechanism for per-test homeserver configuration in the unit tests. ([\#5657](#5657))
- Inline issue_access_token. ([\#5659](#5659))
- Update the sytest BuildKite configuration to checkout Synapse in `/src`. ([\#5664](#5664))
- Add a `docker` type to the towncrier configuration. ([\#5673](#5673))
- Convert `synapse.federation.transport.server` to `async`. Might improve some stack traces. ([\#5689](#5689))
- Documentation for opentracing. ([\#5703](#5703))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants