Skip to content
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

simplify the testing API #16

Open
PietroPasotti opened this issue Feb 9, 2024 · 0 comments
Open

simplify the testing API #16

PietroPasotti opened this issue Feb 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@PietroPasotti
Copy link
Collaborator

as it stands, the testing API is too generic.

you write:

t = Tester(state_in=scenario.State)
t.run("foo-relation-changed")

whereas:

  1. the only part of the state that the test should be concerned about is a single relation
  2. the relation endpoint, and therefore the name of the event we are running, is not owned by the test either, but by the charm being tested.

Proposal:

consider cleaning up the API accordingly

from interface_tester import Relation
t = Tester(relation_in=Relation(remote_app_data={...}))
t.run_relation_changed()
...

This requires:

  1. replacing state_in with relation_in in Tester; use relation_in to construct the usual state_in
  2. adding a dedicated Relation subclass that gets rid of the 'endpoint' argument so the user doesn't even need to think about this. Because unfortunately, endpoint is the only mandatory arg to scenario.state.Relation :D
  3. replacing generic run() with run_relation_changed and similar for other event types.
@PietroPasotti PietroPasotti added the enhancement New feature or request label Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant