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

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

Closed
arkamar opened this issue Sep 4, 2023 · 6 comments · Fixed by #16258
Closed
Assignees
Labels
O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. X-Regression Something broke which worked on a previous release

Comments

@arkamar
Copy link
Contributor

arkamar commented Sep 4, 2023

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:

  • pyicu
  • txredisapi, hiredis
  • psycopg2

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 clokep added S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. X-Regression Something broke which worked on a previous release O-Uncommon Most users are unlikely to come across this or unexpected workflow labels Sep 5, 2023
@clokep
Copy link
Member

clokep commented Sep 5, 2023

Regression from #16125.

@clokep
Copy link
Member

clokep commented Sep 5, 2023

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

@arkamar
Copy link
Contributor Author

arkamar commented Sep 5, 2023

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

arkamar added a commit to arkamar/gentoo that referenced this issue Sep 5, 2023
A patch taken from upstream PR needs to applied in order to skip failing
IntrospectionTokenCacheInvalidationTestCase in test phase when
USE=postgres is set.

Upstream-Issue: matrix-org/synapse#16244
Upstream-PR: matrix-org/synapse#16253
Signed-off-by: Petr Vaněk <[email protected]>
@arkamar
Copy link
Contributor Author

arkamar commented Sep 5, 2023

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

@clokep clokep closed this as completed Sep 6, 2023
@clokep
Copy link
Member

clokep commented Sep 6, 2023

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

@arkamar
Copy link
Contributor Author

arkamar commented Sep 7, 2023

@clokep thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. X-Regression Something broke which worked on a previous release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants