[DPE-10841] test(database): cover the manager's mapping caches and user map (5/7) - #220
Draft
marceloneppel wants to merge 1 commit into
Draft
[DPE-10841] test(database): cover the manager's mapping caches and user map (5/7)#220marceloneppel wants to merge 1 commit into
marceloneppel wants to merge 1 commit into
Conversation
Ports the charm-side provider tests onto the library manager, starting with the state half: the substrate-derived role name, the username and prefixed-database cache round trips, the user->databases map and hash, the peer-sync comparison, and plugin expansion. The secret labels are asserted explicitly because renaming them orphans the caches every deployed cluster already holds. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
marceloneppel
force-pushed
the
feat/02-db-events
branch
from
August 18, 2026 18:23
12e7928 to
1ceb16f
Compare
marceloneppel
force-pushed
the
test/02-db-manager-state
branch
from
August 18, 2026 18:23
f5ea9c3 to
7316a66
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
PRs 1–4 moved
postgresql_provider.pyinto the library. The charm-side tests that covered it are deleted by the adoption PRs, so the coverage has to exist here first.Solution
Ports the charm provider tests onto the library manager, starting with its state half: the substrate-derived role name, the username and prefixed-database cache round trips,
collect_user_relationsand the user hash it derives, the peer-sync comparison, and plugin expansion.The app-secret labels are asserted explicitly — renaming them would orphan the caches every deployed cluster already holds, and nothing else in the tree would notice.
Every test was checked by mutating the production code it targets and confirming it goes red; reverting the mutation restores green. Run with
PYTHONDONTWRITEBYTECODE=1and a__pycache__sweep, since a byte-length-identical mutation otherwise leaves the stale bytecode valid.Stacked on 4/7. Next: 6/7.
Checklist