canonical / ops-scenario

State-transition testing SDK for Operator Framework Juju charms.
Apache License 2.0
10 stars 7 forks source link

feat!: simplify creating deferred events #174

Closed tonyandrewmeyer closed 3 weeks ago

tonyandrewmeyer commented 1 month ago

A couple of changes to simplify setting up the queue of deferred events:

Finally, setting up the DeferredEvent snapshot data only handled workload events and relation events (and wasn't always correct for all relation events). It should now cover all current events with the right snapshot.

tonyandrewmeyer commented 3 weeks ago

@PietroPasotti I decided it would be better to split this in two - so this PR has the backwards-incompatible simplification of always using _Event.deferred rather than scenario.deferred() or instantiating DeferredEvent manually (although that's only discouraged, not prohibited), plus the missing snapshot data. I'm hoping this is fairly uncontentious.

I'll do a separate PR afterwards that has the backwards-compatible "find a handler automatically if possible" feature.