Skip to content

[DPE-10841] test(database): cover the manager's mapping caches and user map (5/7) - #220

Draft
marceloneppel wants to merge 1 commit into
feat/02-db-eventsfrom
test/02-db-manager-state
Draft

[DPE-10841] test(database): cover the manager's mapping caches and user map (5/7)#220
marceloneppel wants to merge 1 commit into
feat/02-db-eventsfrom
test/02-db-manager-state

Conversation

@marceloneppel

Copy link
Copy Markdown
Member

Issue

PRs 1–4 moved postgresql_provider.py into 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_relations and 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=1 and a __pycache__ sweep, since a byte-length-identical mutation otherwise leaves the stale bytecode valid.

Stacked on 4/7. Next: 6/7.

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant