Univention Bugzilla – Bug 54502
Code cleanup for univention-group-membership-cache
Last modified: 2022-10-06 09:49:55 CEST
While looking for code using the new listener API, I stumbled upon the univention-group-membership-cache. I created a little code cleanup.
Cleanup is in MR: https://git.knut.univention.de/univention/ucs/-/merge_requests/296
[5.0-2] 653e645bd2 doc[group-cache]: add PEP-484 type hints .../src/univention/ldap_cache/__init__.py | 1 - .../src/univention/ldap_cache/cache/__init__.py | 13 ++++++----- .../src/univention/ldap_cache/cache/backend/__init__.py | 35 ++++++++++++++++++++--------- .../src/univention/ldap_cache/cache/backend/gdbm_cache.py | 13 +++++++++++ .../src/univention/ldap_cache/cache/backend/lmdb_cache.py | 20 ++++++++++++++--- .../src/univention/ldap_cache/cache/shard_config.py | 7 +++++- .../src/univention/ldap_cache/frontend.py | 22 ++++++++++-------- .../src/univention/ldap_cache/listener_module.py | 8 ++++++- .../src/univention/ldap_cache/log.py | 5 +++-- base/univention-group-membership-cache/univention-ldap-cache | 18 ++++++++++++--- 10 files changed, 107 insertions(+), 35 deletions(-) [5.0-2] 5a6a3a3e87 style[group-cache]: use Python comprehensions base/univention-group-membership-cache/src/univention/ldap_cache/frontend.py | 4 ++-- base/univention-group-membership-cache/unittest/test_backend_cache.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) [5.0-2] d7bebcc01c style[group-cache]: isort .../src/univention/ldap_cache/cache/backend/gdbm_cache.py | 9 ++++----- .../src/univention/ldap_cache/cache/backend/lmdb_cache.py | 3 +-- .../src/univention/ldap_cache/cache/shard_config.py | 5 ++--- base/univention-group-membership-cache/unittest/test_backend_lmdb.py | 5 ++--- base/univention-group-membership-cache/univention-ldap-cache | 8 ++++---- 5 files changed, 13 insertions(+), 17 deletions(-) [5.0-2] 2bf114fb6e fix[group-cache]: template quoting base/univention-group-membership-cache/univention-ldap-cache | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) [5.0-2] 2c473b15c8 refactor[group-cache]: Simplify ArgumentParser base/univention-group-membership-cache/univention-ldap-cache | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) [5.0-2] 643157bce1 refactor[group-cache]: cleanup base/univention-group-membership-cache/debian/changelog | 6 ++++++ .../src/univention/ldap_cache/listener_module.py | 9 ++++----- doc/errata/staging/univention-group-membership-cache.yaml | 12 ++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) Package: univention-group-membership-cache Version: 2.0.0-12A~5.0.0.202209271520 Branch: ucs_5.0-0 Scope: errata5.0-2 [5.0-2] 3c6ffb8e2e Bug #54502: univention-group-membership-cache 2.0.0-12A~5.0.0.202209271520 doc/errata/staging/univention-group-membership-cache.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
The change broke two tests: https://univention-dist-jenkins.k8s.knut.univention.de/job/UCS-5.0/job/UCS-5.0-2/job/AutotestUpgrade/lastCompletedBuild/SambaVersion=no-samba,Systemrolle=master/testReport/13_ldap_cache/30_ldap_cache_custom/test_reverse_cache/ https://univention-dist-jenkins.k8s.knut.univention.de/job/UCS-5.0/job/UCS-5.0-2/job/AutotestUpgrade/lastCompletedBuild/SambaVersion=no-samba,Systemrolle=master/testReport/13_ldap_cache/30_ldap_cache_custom/test_double_cache/
(In reply to Florian Best from comment #3) > The change broke two tests: > https://univention-dist-jenkins.k8s.knut.univention.de/job/UCS-5.0/job/UCS-5.0-2/job/AutotestUpgrade/lastCompletedBuild/SambaVersion=no-samba,Systemrolle=master/testReport/13_ldap_cache/30_ldap_cache_custom/test_reverse_cache/ > https://univention-dist-jenkins.k8s.knut.univention.de/job/UCS-5.0/job/UCS-5.0-2/job/AutotestUpgrade/lastCompletedBuild/SambaVersion=no-samba,Systemrolle=master/testReport/13_ldap_cache/30_ldap_cache_custom/test_double_cache/ This only seems to fail in "no-samba4" environments ? https://univention-dist-jenkins.k8s.knut.univention.de/job/UCS-5.0/job/UCS-5.0-2/job/AutotestJoin/lastCompletedBuild/SambaVersion=no-samba,Systemrolle=master/testReport/13_ldap_cache/30_ldap_cache_custom/test_reverse_cache/ https://univention-dist-jenkins.k8s.knut.univention.de/job/UCS-5.0/job/UCS-5.0-2/job/AutotestJoin/lastCompletedBuild/SambaVersion=no-samba,Systemrolle=master/testReport/13_ldap_cache/30_ldap_cache_custom/test_double_cache/ @jbremer These tests are disabled in environments with S4C as there is a concurrency issue, where the "LDAP group cache" UDL module raises with S4C updating the newly crated users and group and they fail every time. Essential `get()` returns `repr(list)` instead of `list`: > Traceback (most recent call last): > File "/usr/share/ucs-test/13_ldap_cache/30_ldap_cache_custom.py", line 44, in test_reverse_cache > assert testcache.get(user1.props.lastname) == [user1.dn.lower()] > AssertionError: assert '["DN"]' == ['DN'] TBC…
[5.0-2] 4b43351df5 fix[test]: Adapt 13_ldap_cache/conftest.py to changed internal APIo test/ucs-test/debian/changelog | 6 ++++++ test/ucs-test/debian/control | 2 +- test/ucs-test/tests/13_ldap_cache/conftest.py | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) Package: ucs-test Version: 10.0.7-25A~5.0.0.202209291817 Branch: ucs_5.0-0 Scope: errata5.0-2
OK: code review OK: Jenkins tests OK: YAML
<https://errata.software-univention.de/#/?erratum=5.0x444>