Bug 54502 - Code cleanup for univention-group-membership-cache
Code cleanup for univention-group-membership-cache
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: LDAP
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-2-errata
Assigned To: Philipp Hahn
Florian Best
:
Depends on: 54501
Blocks:
  Show dependency treegraph
 
Reported: 2022-03-03 12:02 CET by Daniel Tröder
Modified: 2022-10-06 09:49 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Cleanup
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2022-03-03 12:02:58 CET
While looking for code using the new listener API, I stumbled upon the univention-group-membership-cache. I created a little code cleanup.
Comment 1 Daniel Tröder univentionstaff 2022-03-03 12:05:32 CET
Cleanup is in MR: https://git.knut.univention.de/univention/ucs/-/merge_requests/296
Comment 2 Philipp Hahn univentionstaff 2022-09-27 15:23:13 CEST
[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(-)
Comment 4 Philipp Hahn univentionstaff 2022-09-28 21:03:45 CEST
(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…
Comment 5 Philipp Hahn univentionstaff 2022-09-29 18:22:43 CEST
[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
Comment 6 Florian Best univentionstaff 2022-09-30 15:37:21 CEST
OK: code review
OK: Jenkins tests
OK: YAML