test(observers): cover the observer handlers (5/6) - #262
Draft
marceloneppel wants to merge 1 commit into
Draft
Conversation
2 tasks
Ports the cluster topology observer's start/stop and raft-observer unit-rendering suites from the VM charm onto the library harness: patch targets move from the charms' _peers/_peer_members_ips properties to the library state (peer_relation/peer_members_ips), the harness peer relation backs the positive cases, and the raft-observer test reads its expected systemd unit content from the package templates instead of the charm's templates/ directory. Adds the authorisation rules observer's start/stop coverage (the K8s charm had none): guards on status, peers, container connectivity and cluster initialisation, the already-running and dead-pid restart paths, SIGTERM stop with databag cleanup, and the substrate gating of both handlers' construction on the abstract charm. Every test runs under both substrates via the session fixture and skips itself on the substrate that does not ship the handler. Provenance: tests ported from tests/unit/test_cluster_topology_observer.py @ 03494fb7b77f96b3108d5968b5eb4d4b61fb6f7f (postgresql-operator 16/edge); the authorisation rules handler tests are new, matching the ported behavior. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
marceloneppel
force-pushed
the
observers-4-script-tests
branch
from
September 4, 2026 21:27
9b238f9 to
83e7b51
Compare
marceloneppel
force-pushed
the
observers-5-observer-tests
branch
from
September 4, 2026 21:27
f82b44f to
cef5ced
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
Part of the observers module migration from the PostgreSQL VM and K8s charms' 16/edge branches into this library. Stacks on #261.
Solution
Ports the cluster topology observer's start/stop and raft-observer unit-rendering suites from the VM charm onto the library harness: patch targets move from the charms'
_peers/_peer_members_ipsproperties to the library state (peer_relation/peer_members_ips), the harness peer relation backs the positive cases, and the raft-observer test reads its expected systemd unit content from the package templates instead of the charm'stemplates/directory.Adds the authorisation rules observer's start/stop coverage (the K8s charm had none): guards on status, peers, container connectivity and cluster initialisation, the already-running and dead-pid restart paths, SIGTERM stop with databag cleanup, and the substrate gating of both handlers' construction on the abstract charm.
Every test runs under both substrates via the session fixture and skips itself on the substrate that does not ship the handler.
Provenance: tests ported from
tests/unit/test_cluster_topology_observer.py@03494fb7b77f96b3108d5968b5eb4d4b61fb6f7f(postgresql-operator 16/edge); the authorisation rules handler tests are new, matching the ported behavior.Checklist
Wiring up at canonical/postgresql-operator#1940 and canonical/postgresql-k8s-operator#1725.