-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extra bindings and network model rework [Do not merge] #88
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Direction and new model seems good to me, thanks.
Just a few Python style comments.
@benhoyt @tonyandrewmeyer after some more investigation and a chat with Ian Booth which I quote below, I reworked again the interface bringing it API-wise somewhat close to where we started, but the semantics is more simple. In a nutshell: from now on in Scenario, the charm will be able to do If you want to override the network associated with a given endpoint or extra-binding, you can pass
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's quite a lot simpler -- nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Fixes #87
This PR adds support for extra-bindings and reworks the network model to hopefully match Juju's more closely.
Issue: at the moment, if you want to add a Network, you always have to pass it in manually:
State(relations=[rel1, rel2], networks=[net1, net2])
While in fact the presence of an integration endpoint implies the presence of a network. So it feels like a charm should automatically have networks for each of its metadata-defined relation endpoints, regardless of whether the relations are 'alive' i.e. in State.
This PR changes the semantics and the type of
State.networks
: from an exhaustive list of the networks available to the charm being tested, to a binding name --> Network mapping:State.networks: Dict[str, Network]
The logic for
network_get(binding:str, relation_id:Optional[int])
is also updated:State.networks[binding]
if found, else a default network.State.networks[binding]
if found, else a default network.The idea is that now
State.networks
is an override mapping. The default network which you automatically get for each relation endpoint and extra-binding is not good enough, you can override it with a custom-defined one. For the most part, you will probably be fine using the default network, since in theory the charm should not have opinions about what IP it gets.This is breaking, non-backwards-compatible, API change. Will release as v6.