Hi all! Scenario 4.0 just released with a number of interesting updates!
How to get
pip install ops-scenario==4.0
Added
- Added support for custom events
- Added support for testing actions
Changed
-
Statecleanup: some things that did not quite belong inStateare now lifted toContext:State.juju_log --> Context.juju_logState.[unit|app]_status_history --> Context.[unit|app]_status_historyState.workload_version_history --> Context.workload_version_history
-
Statusremoved. For the sake of flattening some excessively nested data structures:State.status.app --> State.app_statusState.status.unit --> State.unit_statusState.status.workload_version --> State.workload_version
- The
emitted eventspytest plugin (experimental) is removed and instead one can rely on theContextto natively and always expose that information. To get a list of all events emitted on the charm during this execution you can getContext.emitted_events. - Definitely removed support for
trigger()api.
Bugfixes
- Fixed an issue that would break
from scenario import *. - Fixed an issue with secret events.
Migrating from scenario 3
Is pretty easy. See how I did that in traefik