matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.82k stars 2.13k forks source link

Synapse-1.91.1 unittest fails with Postgres DB due to missing optional authlib dependency #16244

Closed arkamar closed 1 year ago

arkamar commented 1 year ago

Description

When running unit tests for Synapse versions 1.91.1 (and 1.91.0 as well) with Postgres database enabled, the tests fail with a

synapse.config._base.ConfigError: ('MSC3861 is enabled but `authlib` is not installed. Please install authlib to use MSC3861.', ('experimental', 'msc3861', 'enabled'))

error indicating that authlib is not installed, however, nothing suggest it is newly required. This issue does not occur in version 1.90.0, where all tests pass with Postgres DB.

This output is produced in test phase of Gentoo ebuild.

Steps to reproduce

Run tests with Postgres DB but without authlib.

Homeserver

unittest framework

Synapse Version

1.91.1

Installation Method

Other (please mention below)

Database

single PostgreSQL, fresh instance for tests

Workers

I don't know

Platform

Gentoo AMD64

Configuration

Following optional dependencies are installed:

Relevant log output

===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1/tests/unittest.py", line 122, in new
    return code(orig, *args, **kwargs)
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1/tests/unittest.py", line 216, in setUp
    return orig()
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1/tests/replication/_base.py", line 256, in setUp
    super().setUp()
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1/tests/unittest.py", line 338, in setUp
    self.hs = self.make_homeserver(self.reactor, self.clock)
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1/tests/unittest.py", line 451, in make_homeserver
    hs = self.setup_test_homeserver()
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1/tests/unittest.py", line 595, in setup_test_homeserver
    config_obj = make_homeserver_config_obj(config)
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1/tests/unittest.py", line 172, in make_homeserver_config_obj
    config_obj = _parse_config_dict(json.dumps(config, sort_keys=True))
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1/tests/unittest.py", line 157, in _parse_config_dict
    config_obj.parse_config_dict(json.loads(config), "", "")
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1-python3_11/install/usr/lib/python3.11/site-packages/
synapse/config/_base.py", line 823, in parse_config_dict
    self.invoke_all(
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1-python3_11/install/usr/lib/python3.11/site-packages/synapse/config/_base.py", line 422, in invoke_all
    res[config_class.section] = getattr(config, func_name)(*args, **kwargs)
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1-python3_11/install/usr/lib/python3.11/site-packages/synapse/config/experimental.py", line 401, in read_config
    self.msc3861 = MSC3861(**experimental.get("msc3861", {}))
  File "<attrs generated init synapse.config.experimental.MSC3861>", line 13, in __init__
    __attr_validator_enabled(self, __attr_enabled, self.enabled)
  File "/usr/lib/python3.11/site-packages/attr/_make.py", line 2927, in __call__
    v(inst, attr, value)
  File "/var/tmp/portage/net-im/synapse-1.91.1/work/synapse-1.91.1-python3_11/install/usr/lib/python3.11/site-packages/synapse/config/experimental.py", line 70, in _check_enabled
    raise ConfigError(
synapse.config._base.ConfigError: ('MSC3861 is enabled but authlib is not installed. Please install authlib to use MSC3861.', ('experimental', 'msc3861', 'enabled'))

tests.replication.test_intro_token_invalidation.IntrospectionTokenCacheInvalidationTestCase.test_stream_introspection_token_invalidation
-------------------------------------------------------------------------------
Ran 2895 tests in 254.077s

FAILED (skips=134, errors=1, successes=2760)

Anything else that would be useful to know?

No response

clokep commented 1 year ago

Regression from #16125.

clokep commented 1 year ago

@arkamar Could you test #16253? It should properly skip those tests now.

arkamar commented 1 year ago

@clokep I tested it anyway, all tests pass in commit 8e9a72dcfc20ae2cce502ee04a173e9e7.

arkamar commented 1 year ago

For those dealing with the same issue, it persists in v1.92.0rc1.

clokep commented 1 year ago

This is fixed in v1.91.2. The next release off the 1.92 branch will include this fix too.

arkamar commented 1 year ago

@clokep thanks!