feat!: inject Juju default databag keys at exec time#2637
Draft
tonyandrewmeyer wants to merge 1 commit into
Draft
feat!: inject Juju default databag keys at exec time#2637tonyandrewmeyer wants to merge 1 commit into
tonyandrewmeyer wants to merge 1 commit into
Conversation
Relation databags (`local_unit_data`, `remote_units_data`, `remote_unit_data`) now default to empty dicts. Just before the charm runs, Scenario injects the keys Juju itself auto-populates (`egress-subnets`, `ingress-address`, and on Juju 3 `private-address`) into every unit databag, and they flow through to the output state. This is the backwards-incompatible alternative to canonical#2618: instead of stripping `private-address` from the construction default when the mocked Juju version is 4+, Scenario now matches Juju's own behaviour and only inserts the keys the real Juju would insert. Tests that read a `Relation`'s databag before running the charm will see empty dicts. Fixes canonical#2185. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.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.
Relation databags (
local_unit_data,remote_units_data,remote_unit_data) now default to empty dicts. Just before the charm runs, Scenario injects the keys Juju itself auto-populates (egress-subnets,ingress-address, and on Juju 3private-address) into every unit databag, and they flow through to the output state.This is the backwards-incompatible alternative to #2618: instead of stripping
private-addressfrom the construction default when the mocked Juju version is 4+, Scenario now matches Juju's own behaviour and only inserts the keys the real Juju would insert. Tests that read aRelation's databag before running the charm will see empty dicts.Fixes #2185.