canonical / ops-scenario

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

context.run mutates adds default values to input config #144

Closed PietroPasotti closed 2 months ago

PietroPasotti commented 2 months ago

Scenario should mutate the input state as little as necessary.

It is desirable that, if you passed no config, the output state still has no config.

traefik_state = State(config={})
state_out = traefik_ctx.run('update-status', traefik_state)

assert state_out.config == {}

However scenario needs to present some data to the config-get hook and so it populates the config before running the charm. However, it forgets to clean it up by removing any keys that were added by scenario itself in the process.