Draft
Conversation
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…pers Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…ation-loop Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…ation-loop Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…n tests & secret handling
- Add _validate_single_table to validate subscription table format, existence,
emptiness and detect cyclic logical-replication (reject subscriptions where
publisher upstream equals subscriber). Improve validation flow to call this
helper for each requested table.
- Use postgresql.table_exists and postgresql.is_table_empty for accurate checks.
- Improve logging messages and formatting during upstream determination and
configured-time comparison.
- Fix configured-time comparison code formatting and simplify generator usage.
- Remove unused requester_id variable.
- In offer propagation, allow direct propagation to offers via
_propagate_upstream_to_offers(mapping, set_configured_time=False) (used in
tests) instead of relying on full rebuild that may overwrite manual mappings.
- Tests (unit + integration):
- Patch charm.postgresql property via PropertyMock to return a DB mock and
mock DB operations (create_user, create_publication, grant/revoke, delete_user,
drop_publication) to avoid real DB connections.
- Mock logical_replication._create_user and charm.update_config to avoid
database/K8s API access.
- Create model secret in harness and set secret-id in app relation data to
simulate provided credentials (no external secret store needed).
- Adjust test data formatting and minor style cleanups.
- Misc: small formatting / logging string normalization for readability.
This change improves validation safety (prevents cycles and invalid table
subscriptions), and makes tests hermetic by fully mocking external DB/K8s
dependencies.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…ation-loop Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
This reverts commit 8d51bc2. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…ed key Expose logical_replication_subscription_request in the Pydantic config (Field(default=None)) and update test to use the hyphenated "logical-replication-subscription-request" key. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Codecov Report❌ Patch coverage is ❌ Your project check has failed because the head coverage (67.10%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## 16/edge #1193 +/- ##
===========================================
- Coverage 68.93% 67.10% -1.83%
===========================================
Files 17 18 +1
Lines 3850 4332 +482
Branches 577 657 +80
===========================================
+ Hits 2654 2907 +253
- Misses 990 1176 +186
- Partials 206 249 +43 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ation-loop Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…ance tracking Add per-table upstream provenance to detect replication cycles and correctly identify origin nodes. Nodes now report themselves as origin for tables they don't subscribe to, enabling accurate cycle detection in multi-hop chains. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…ation-loop Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
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
Solution
Checklist